Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming column name with index generates wrong migrations #259

Open
jeroen11dijk opened this issue May 2, 2024 · 0 comments
Open

Renaming column name with index generates wrong migrations #259

jeroen11dijk opened this issue May 2, 2024 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@jeroen11dijk
Copy link

I had a resource with a start_date with an index but I renamed it to date and while generating the migration it switched the order around by first adding an index before renaming the column which will result in a crash.

def up do
    drop_if_exists index(:events, [:start_date])

    create index(:events, [:date])

    rename table(:events), :start_date, to: :date

    alter table(:events) do
      modify :date, :date
    end
  end
@jeroen11dijk jeroen11dijk added bug Something isn't working needs review labels May 2, 2024
@zachdaniel zachdaniel added good first issue Good for newcomers and removed needs review labels May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants