File tree Expand file tree Collapse file tree 2 files changed +37
-3
lines changed
packages/media/database/migrations Expand file tree Collapse file tree 2 files changed +37
-3
lines changed Original file line number Diff line number Diff line change 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+ * Run the migrations.
10+ */
11+ public function up(): void
12+ {
13+ Schema::create('media_collection_translations', function (Blueprint $table) {
14+ $table->increments('id');
15+ $table->unsignedBigInteger('media_collection_id');
16+ $table->string('locale')->index();
17+ $table->string('name');
18+ $table->text('description')->nullable();
19+ $table->timestamps();
20+
21+ $table->unique(['media_collection_id', 'locale']);
22+ $table->foreign('media_collection_id')->references('id')->on('media_collections')->onDelete('cascade');
23+ });
24+ }
25+
26+ /**
27+ * Reverse the migrations.
28+ */
29+ public function down(): void
30+ {
31+ Schema::dropIfExists('media_collection_translations');
32+ }
33+ };
Original file line number Diff line number Diff line change @@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
44use Illuminate\Database\Schema\Blueprint;
55use Illuminate\Support\Facades\Schema;
66
7- return new class extends Migration
8- {
7+ return new class extends Migration {
98 public function up(): void
109 {
1110 Schema::create('media', function (Blueprint $table) {
@@ -16,7 +15,9 @@ return new class extends Migration
1615
1716 $table->uuid()->nullable()->unique();
1817 $table->nullableMorphs('original_model');
19- $table->string('collection_name');
18+ $table->unsignedBigInteger('media_collection_id')->nullable();
19+ $table->foreign('media_collection_id')->references('id')->on('media_collections')->onDelete('set null');
20+ $table->string('collection_name')->nullable();
2021 $table->string('file_name');
2122 $table->string('mime_type')->nullable();
2223 $table->boolean('write_protected')->default(false);
You can’t perform that action at this time.
0 commit comments