@@ 6-37 (lines=32) @@ | ||
3 | use Illuminate\Database\Migrations\Migration; |
|
4 | use Illuminate\Database\Schema\Blueprint; |
|
5 | ||
6 | class CreatePostTranslationsTable extends Migration |
|
7 | { |
|
8 | /** |
|
9 | * Run the migrations. |
|
10 | * |
|
11 | * @return void |
|
12 | */ |
|
13 | public function up() |
|
14 | { |
|
15 | Schema::create('blog__post_translations', function (Blueprint $table) { |
|
16 | $table->engine = 'InnoDB'; |
|
17 | $table->increments('id'); |
|
18 | $table->integer('post_id')->unsigned(); |
|
19 | $table->string('locale')->index(); |
|
20 | $table->string('title'); |
|
21 | $table->string('slug'); |
|
22 | $table->text('content'); |
|
23 | $table->unique(['post_id', 'locale']); |
|
24 | $table->foreign('post_id')->references('id')->on('blog__posts')->onDelete('cascade'); |
|
25 | }); |
|
26 | } |
|
27 | ||
28 | /** |
|
29 | * Reverse the migrations. |
|
30 | * |
|
31 | * @return void |
|
32 | */ |
|
33 | public function down() |
|
34 | { |
|
35 | Schema::drop('blog__post_translations'); |
|
36 | } |
|
37 | } |
|
38 |
@@ 6-36 (lines=31) @@ | ||
3 | use Illuminate\Database\Migrations\Migration; |
|
4 | use Illuminate\Database\Schema\Blueprint; |
|
5 | ||
6 | class CreateCategoryTranslationsTable extends Migration |
|
7 | { |
|
8 | /** |
|
9 | * Run the migrations. |
|
10 | * |
|
11 | * @return void |
|
12 | */ |
|
13 | public function up() |
|
14 | { |
|
15 | Schema::create('blog__category_translations', function (Blueprint $table) { |
|
16 | $table->engine = 'InnoDB'; |
|
17 | $table->increments('id'); |
|
18 | $table->string('name'); |
|
19 | $table->string('slug'); |
|
20 | $table->integer('category_id')->unsigned(); |
|
21 | $table->string('locale')->index(); |
|
22 | $table->unique(['category_id', 'locale']); |
|
23 | $table->foreign('category_id')->references('id')->on('blog__categories')->onDelete('cascade'); |
|
24 | }); |
|
25 | } |
|
26 | ||
27 | /** |
|
28 | * Reverse the migrations. |
|
29 | * |
|
30 | * @return void |
|
31 | */ |
|
32 | public function down() |
|
33 | { |
|
34 | Schema::drop('blog__category_translations'); |
|
35 | } |
|
36 | } |
|
37 |
@@ 6-36 (lines=31) @@ | ||
3 | use Illuminate\Database\Migrations\Migration; |
|
4 | use Illuminate\Database\Schema\Blueprint; |
|
5 | ||
6 | class CreateTagTranslationsTable extends Migration |
|
7 | { |
|
8 | /** |
|
9 | * Run the migrations. |
|
10 | * |
|
11 | * @return void |
|
12 | */ |
|
13 | public function up() |
|
14 | { |
|
15 | Schema::create('blog__tag_translations', function (Blueprint $table) { |
|
16 | $table->engine = 'InnoDB'; |
|
17 | $table->increments('id'); |
|
18 | $table->string('name'); |
|
19 | $table->string('slug'); |
|
20 | $table->integer('tag_id')->unsigned(); |
|
21 | $table->string('locale')->index(); |
|
22 | $table->unique(['tag_id', 'locale']); |
|
23 | $table->foreign('tag_id')->references('id')->on('blog__tags')->onDelete('cascade'); |
|
24 | }); |
|
25 | } |
|
26 | ||
27 | /** |
|
28 | * Reverse the migrations. |
|
29 | * |
|
30 | * @return void |
|
31 | */ |
|
32 | public function down() |
|
33 | { |
|
34 | Schema::drop('blog__tag_translations'); |
|
35 | } |
|
36 | } |
|
37 |