diff --git a/database/migrations/0000_00_00_000001_create_images__table.php b/database/migrations/0000_00_00_000001_create_images__table.php index c49fdbc..ac58a78 100755 --- a/database/migrations/0000_00_00_000001_create_images__table.php +++ b/database/migrations/0000_00_00_000001_create_images__table.php @@ -11,10 +11,10 @@ class CreateImagesTable extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('images', function (Blueprint $table) { - $table->integer('id', true); + $table->id(); $table->string('filename'); $table->dateTime('created_at'); $table->dateTime('updated_at'); @@ -27,7 +27,7 @@ class CreateImagesTable extends Migration * * @return void */ - public function down() + public function down(): void { Schema::drop('images'); } diff --git a/database/migrations/0000_00_00_000002_create_associate_images.php b/database/migrations/0000_00_00_000002_create_associate_images.php index 78e76a5..242653c 100755 --- a/database/migrations/0000_00_00_000002_create_associate_images.php +++ b/database/migrations/0000_00_00_000002_create_associate_images.php @@ -11,17 +11,14 @@ class CreateAssociateImages extends Migration * * @return void */ - public function up() + public function up(): void { Schema::create('associate_images', function (Blueprint $table) { - $table->integer('id', true); - $table->integer('image_id'); + $table->id(); + $table->foreignId('image_id')->constrained()->onDelete('cascade'); $table->string('relation_type'); - $table->integer('relation_id'); + $table->unsignedBigInteger('relation_id'); $table->integer('position')->nullable(); - - $table->foreign('image_id')->references('id')->on('images')->onDelete('cascade'); - }); } @@ -30,9 +27,8 @@ class CreateAssociateImages extends Migration * * @return void */ - public function down() + public function down(): void { Schema::drop('associate_images'); - } }