move into sonardesk
This commit is contained in:
+12
-2
@@ -3,6 +3,16 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
return new class extends Migration {
|
||||
public function up(): void { Schema::table('download_products',function(Blueprint $table){$table->longText('release_notes')->nullable();$table->text('minimum_system')->nullable();$table->integer('sort_order')->default(0);}); }
|
||||
public function down(): void {Schema::table('download_products',function(Blueprint $table){$table->dropColumn(['release_notes','minimum_system','sort_order']);});}
|
||||
public function up(): void {
|
||||
if (!Schema::hasTable('download_products')) return;
|
||||
foreach (['release_notes' => 'longText', 'minimum_system' => 'text', 'sort_order' => 'integer'] as $column => $type) {
|
||||
if (!Schema::hasColumn('download_products', $column)) {
|
||||
Schema::table('download_products', function (Blueprint $table) use ($column, $type) {
|
||||
$definition = $table->{$type}($column);
|
||||
if ($column === 'sort_order') $definition->default(0); else $definition->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
public function down(): void { /* Preserve existing download metadata. */ }
|
||||
};
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
return new class extends Migration {
|
||||
public function up(): void {
|
||||
if (!Schema::hasTable('download_products')) return;
|
||||
foreach (['release_notes'=>'longText','minimum_system'=>'text','sort_order'=>'integer'] as $column=>$type) {
|
||||
if (!Schema::hasColumn('download_products',$column)) Schema::table('download_products',function(Blueprint $table) use ($column,$type) {
|
||||
$c=$table->{$type}($column); if ($column==='sort_order') $c->default(0); else $c->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
public function down(): void { /* Keep uploaded download metadata intact. */ }
|
||||
};
|
||||
Reference in New Issue
Block a user