@@ 88-101 (lines=14) @@ | ||
85 | ); |
|
86 | } |
|
87 | ||
88 | if (!Schema::hasTable('ginopane_blogtaxonomy_post_tag')) { |
|
89 | Schema::create( |
|
90 | 'ginopane_blogtaxonomy_post_tag', |
|
91 | static function ($table) { |
|
92 | $table->engine = 'InnoDB'; |
|
93 | ||
94 | $table->integer('tag_id')->unsigned()->nullable()->default(null); |
|
95 | $table->integer('post_id')->unsigned()->nullable()->default(null); |
|
96 | $table->index(['tag_id', 'post_id']); |
|
97 | $table->foreign('tag_id')->references('id')->on(Tag::TABLE_NAME)->onDelete('cascade'); |
|
98 | $table->foreign('post_id')->references('id')->on('rainlab_blog_posts')->onDelete('cascade'); |
|
99 | } |
|
100 | ); |
|
101 | } |
|
102 | } |
|
103 | ||
104 | /** |
@@ 29-42 (lines=14) @@ | ||
26 | */ |
|
27 | public function down() |
|
28 | { |
|
29 | if (!Schema::hasTable('ginopane_blogtaxonomy_post_tag')) { |
|
30 | Schema::create( |
|
31 | 'ginopane_blogtaxonomy_post_tag', |
|
32 | static function ($table) { |
|
33 | $table->engine = 'InnoDB'; |
|
34 | ||
35 | $table->integer('tag_id')->unsigned()->nullable()->default(null); |
|
36 | $table->integer('post_id')->unsigned()->nullable()->default(null); |
|
37 | $table->index(['tag_id', 'post_id']); |
|
38 | $table->foreign('tag_id')->references('id')->on(Tag::TABLE_NAME)->onDelete('cascade'); |
|
39 | $table->foreign('post_id')->references('id')->on('rainlab_blog_posts')->onDelete('cascade'); |
|
40 | } |
|
41 | ); |
|
42 | } |
|
43 | } |
|
44 | } |
|
45 |