File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -2333,11 +2333,22 @@ defmodule AshPostgres.MigrationGenerator do
23332333 end )
23342334 end
23352335 |> Enum . map ( fn identity ->
2336+ orders =
2337+ identity . keys
2338+ |> Enum . map ( & Enum . find_index ( snapshot . attributes , fn attr -> attr . source == & 1 end ) )
2339+ |> Enum . reject ( & is_nil / 1 )
2340+
2341+ insert_after_attribute_order =
2342+ case orders do
2343+ [ ] -> nil
2344+ _ -> Enum . max ( orders )
2345+ end
2346+
23362347 % Operation.AddUniqueIndex {
23372348 identity: identity ,
23382349 schema: snapshot . schema ,
23392350 table: snapshot . table ,
2340- insert_after_attribute_order: max ( 0 , length ( snapshot . attributes ) - 1 ) ,
2351+ insert_after_attribute_order: insert_after_attribute_order ,
23412352 concurrently: opts . concurrent_indexes
23422353 }
23432354 end )
You can’t perform that action at this time.
0 commit comments