| @@ 91-99 (lines=9) @@ | ||
| 88 | if (!Schema::hasTable(Tag::CROSS_REFERENCE_TABLE_NAME)) { |
|
| 89 | Schema::create( |
|
| 90 | Tag::CROSS_REFERENCE_TABLE_NAME, |
|
| 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 | } |
|
| @@ 32-40 (lines=9) @@ | ||
| 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 | } |
|