Revision 579 | Revision 597 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed
<?phpuse Illuminate\Database\Migrations\Migration;use Illuminate\Database\Schema\Blueprint;use Illuminate\Support\Facades\Schema;return new class extends Migration{/*** Run the migrations.** @return void*/public function up(): void{if ( !Schema::hasTable( 'items' ) ){Schema::create( 'items', function ( Blueprint $table ){$table->id();$table->foreignId( "manufacturer_id" )->nullable()->constrained()->cascadeOnUpdate()->nullOnDelete();$table->string( "name" )->default( '' );$table->string( "slug" )->default( '' );$table->unsignedTinyInteger( 'status' )->default( '0' );$table->text( 'description' )->default( '' );$table->string( 'ean', 13 )->default( '' );$table->string( 'kennung' )->default( '' );$table->string( 'short_line_1' )->default( '' );$table->foreignId( "directory_id" )->unsigned( false )->nullable()->constrained()->cascadeOnUpdate()->nullOnDelete();$table->string( 'created_by' )->default( '' );$table->string( 'updated_by' )->default( '' );$table->timestamps();} );}if ( !ScHema::hasColumn( 'items', 'name' ) ){Schema::table( 'items', function ( Blueprint $table ){$table->string( "name" )->default( '' )->after( 'id' );} );}if ( !ScHema::hasColumn( 'items', 'directory_id' ) ){Schema::table( 'items', function ( Blueprint $table ){$table->bigInteger( "directory_id" )->nullable()->after( "name" );$table->foreignId( 'directory_id' )->constrained()->cascadeOnUpdate()->nullOnDelete();} );}}/*** Reverse the migrations.** @return void*/public function down(): void{Schema::dropIfExists( 'items' );}};