| @@ 14-26 (lines=13) @@ | ||
| 11 | * |
|
| 12 | * @return void |
|
| 13 | */ |
|
| 14 | public function up() |
|
| 15 | { |
|
| 16 | Schema::table('translations', function (Blueprint $table) { |
|
| 17 | $table->dropPrimary('translations_pk'); |
|
| 18 | }); |
|
| 19 | ||
| 20 | Schema::table('translations', function (Blueprint $table) { |
|
| 21 | $table->id()->first(); |
|
| 22 | $table->unsignedInteger('translatable_source'); |
|
| 23 | $table->index(['translatable_type', 'translatable_source'], 'source_idx'); |
|
| 24 | $table->index(['translation_id', 'translatable_id', 'translatable_type'], 'eager_idx'); |
|
| 25 | }); |
|
| 26 | } |
|
| 27 | ||
| 28 | /** |
|
| 29 | * Reverse the migrations. |
|
| @@ 33-44 (lines=12) @@ | ||
| 30 | * |
|
| 31 | * @return void |
|
| 32 | */ |
|
| 33 | public function down() |
|
| 34 | { |
|
| 35 | Schema::table('translations', function (Blueprint $table) { |
|
| 36 | $table->dropColumn(['id', 'translatable_source']); |
|
| 37 | }); |
|
| 38 | ||
| 39 | Schema::table('translations', function (Blueprint $table) { |
|
| 40 | $table->primary(['locale_id', 'translation_id', 'translatable_id', 'translatable_type'], 'translations_pk'); |
|
| 41 | $table->dropIndex('source_idx'); |
|
| 42 | $table->dropIndex('eager_idx'); |
|
| 43 | }); |
|
| 44 | } |
|
| 45 | } |
|
| 46 | ||