update migration
This commit is contained in:
parent
b7140d290f
commit
bc46125a3e
|
@ -11,10 +11,10 @@ class CreateImagesTable extends Migration
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('images', function (Blueprint $table) {
|
Schema::create('images', function (Blueprint $table) {
|
||||||
$table->integer('id', true);
|
$table->id();
|
||||||
$table->string('filename');
|
$table->string('filename');
|
||||||
$table->dateTime('created_at');
|
$table->dateTime('created_at');
|
||||||
$table->dateTime('updated_at');
|
$table->dateTime('updated_at');
|
||||||
|
@ -27,7 +27,7 @@ class CreateImagesTable extends Migration
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::drop('images');
|
Schema::drop('images');
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,17 +11,14 @@ class CreateAssociateImages extends Migration
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('associate_images', function (Blueprint $table) {
|
Schema::create('associate_images', function (Blueprint $table) {
|
||||||
$table->integer('id', true);
|
$table->id();
|
||||||
$table->integer('image_id');
|
$table->foreignId('image_id')->constrained()->onDelete('cascade');
|
||||||
$table->string('relation_type');
|
$table->string('relation_type');
|
||||||
$table->integer('relation_id');
|
$table->unsignedBigInteger('relation_id');
|
||||||
$table->integer('position')->nullable();
|
$table->integer('position')->nullable();
|
||||||
|
|
||||||
$table->foreign('image_id')->references('id')->on('images')->onDelete('cascade');
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,9 +27,8 @@ class CreateAssociateImages extends Migration
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::drop('associate_images');
|
Schema::drop('associate_images');
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue