Skip to content

Commit d5c55f6

Browse files
committed
fix: add and remove custom indexes in tandem properly
1 parent a3ee481 commit d5c55f6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/migration_generator/migration_generator.ex

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,9 +1721,10 @@ defmodule AshPostgres.MigrationGenerator do
17211721

17221722
custom_indexes_to_add =
17231723
Enum.filter(snapshot.custom_indexes, fn index ->
1724-
!Enum.find(old_snapshot.custom_indexes, fn old_custom_index ->
1725-
indexes_match?(snapshot.table, old_custom_index, index)
1726-
end)
1724+
(rewrite_all_identities? && !index.all_tenants?) ||
1725+
!Enum.find(old_snapshot.custom_indexes, fn old_custom_index ->
1726+
indexes_match?(snapshot.table, old_custom_index, index)
1727+
end)
17271728
end)
17281729
|> Enum.map(fn custom_index ->
17291730
%Operation.AddCustomIndex{

0 commit comments

Comments
 (0)