update migration

This commit is contained in:
Cassandre Cantet 2020-11-28 00:05:00 +01:00
parent b7140d290f
commit bc46125a3e
2 changed files with 8 additions and 12 deletions

View File

@ -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');
}

View File

@ -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');
}
}