Skip to content

Commit 643678c

Browse files
committed
feat: create new migration file & delete redundant migration file
1 parent 625f3cd commit 643678c

2 files changed

Lines changed: 73 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::table('world_heritage_sites', function (Blueprint $table) {
15+
$table->string('study_region')->nullable()->after('country');
16+
});
17+
}
18+
19+
/**
20+
* Reverse the migrations.
21+
*/
22+
public function down(): void
23+
{
24+
Schema::table('world_heritage_sites', function (Blueprint $table) {
25+
$table->dropColumn('study_region');
26+
});
27+
}
28+
};
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::dropIfExists('images');
15+
}
16+
17+
/**
18+
* Reverse the migrations.
19+
*/
20+
public function down(): void
21+
{
22+
Schema::create('images', function (Blueprint $table) {
23+
$table->bigIncrements('id');
24+
$table->unsignedInteger('world_heritage_id')->index();
25+
$table->string('disk');
26+
$table->string('path');
27+
$table->unsignedInteger('width')->nullable();
28+
$table->unsignedInteger('height')->nullable();
29+
$table->string('format', 10)->nullable();
30+
$table->string('checksum', 64)->nullable()->index();
31+
$table->unsignedInteger('sort_order')->default(0);
32+
$table->string('alt')->nullable();
33+
$table->string('credit')->nullable();
34+
$table->timestamps();
35+
36+
$table->foreign('world_heritage_id')
37+
->references('id')
38+
->on('world_heritage_sites')
39+
->cascadeOnDelete();
40+
41+
$table->unique(['disk', 'path']);
42+
$table->index(['world_heritage_id', 'sort_order']);
43+
});
44+
}
45+
};

0 commit comments

Comments
 (0)