Skip to content

Commit

Permalink
Fix generating unique index creation calls.
Browse files Browse the repository at this point in the history
Uses the actual unique index constraints to generate indexes, that way
the correct index name is being used, and it won't create indexes that
do not actually exist in the schema that is being snapshotted (this
might have been done to emulate MySQL, where indexes are automatically
created for foreign keys).
  • Loading branch information
ndm2 authored and othercorey committed Sep 22, 2023
1 parent aaf8729 commit 1a185c8
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function up(): void
'product_id',
],
[
'name' => 'orders_product_category_idx',
'name' => 'product_category',
]
)
->create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public function up(): void
'product_id',
],
[
'name' => 'orders_product_category_idx',
'name' => 'product_category',
]
)
->create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function up(): void
'slug',
],
[
'name' => 'categories_slug_unique',
'name' => 'categories_unique_slug',
'unique' => true,
]
)
Expand Down Expand Up @@ -181,7 +181,7 @@ public function up(): void
'product_id',
],
[
'name' => 'orders_product_category_idx',
'name' => 'product_category',
]
)
->create();
Expand Down Expand Up @@ -254,7 +254,7 @@ public function up(): void
'slug',
],
[
'name' => 'products_slug_unique',
'name' => 'products_unique_slug',
'unique' => true,
]
)
Expand Down Expand Up @@ -320,7 +320,7 @@ public function up(): void
'article_id',
],
[
'name' => 'special_tags_article_unique',
'name' => 'UNIQUE_TAG2',
'unique' => true,
]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function up(): void
'slug',
],
[
'name' => 'categories_slug_unique',
'name' => 'categories_unique_slug',
'unique' => true,
]
)
Expand Down Expand Up @@ -150,7 +150,7 @@ public function up(): void
'product_id',
],
[
'name' => 'orders_product_category_idx',
'name' => 'product_category',
]
)
->create();
Expand Down Expand Up @@ -209,7 +209,7 @@ public function up(): void
'slug',
],
[
'name' => 'products_slug_unique',
'name' => 'products_unique_slug',
'unique' => true,
]
)
Expand Down Expand Up @@ -267,7 +267,7 @@ public function up(): void
'article_id',
],
[
'name' => 'special_tags_article_unique',
'name' => 'UNIQUE_TAG2',
'unique' => true,
]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function up(): void
'slug',
],
[
'name' => 'categories_slug_unique',
'name' => 'categories_unique_slug',
'unique' => true,
]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public function up(): void
'product_id',
],
[
'name' => 'orders_product_category_idx',
'name' => 'product_category',
]
)
->create();
Expand Down
2 changes: 1 addition & 1 deletion tests/comparisons/Migration/test_snapshot_not_empty.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public function up(): void
'product_id',
],
[
'name' => 'orders_product_category_idx',
'name' => 'product_category',
]
)
->create();
Expand Down

0 comments on commit 1a185c8

Please sign in to comment.