Possible unsafe migrations warning

Open
#462 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
elixir, postgresql
Domain
databases

Research direction

Start by reproducing the generated migration for the unique album index shown in the issue and trace the migration codegen path that produces it. Determine how unsafe PostgreSQL index creation should be detected or represented, then add coverage showing that the generated migration handles or warns about non-concurrent indexes.

Written by the indexing model from the issue text.

Description

enhancement

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
there are some libraries that will let you know about unsafe migrations where you can check what to avoid
rails - there is also one for elixir but as ash generates the migrations most of the stuff can be applied by changing the codegen.

Dominant language
Elixir
Stars
191
Forks
186
Avg merge
16h 4m
Merged PRs (30d)
17

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ash-project/ash_postgres

All issues in ash-project/ash_postgres

Similar issues

More Elixir issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.