ash-project / ash-project/ash_postgres

Possible unsafe migrations warning

Open
#462 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Elixir
Stars
189
Forks
168
Avg merge
13h 1m
Merged PRs (30d)
22

Description

I'm working through the book and I see that when a migration is generated for new index it's not applying `concurrently: true`
```
def up do
create unique_index(:albums, [:name, :artist_id],
name: "albums_unique_album_names_per_artist_index"
)
end
```
This locks the table and with bigger databases can cause problems:
[postgres docs](https://www.postgresql.org/docs/current/sql-createindex.html#SQL-CREATEINDEX-CONCURRENTLY)
there are some libraries that will let you know about unsafe migrations where you can check what to avoid
[rails](https://github.com/ankane/strong_migrations?tab=readme-ov-file#adding-an-index-non-concurrently) - there is also one for [elixir](https://hexdocs.pm/excellent_migrations/readme.html) but as ash generates the migrations most of the stuff can be applied by changing the codegen.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.