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

Add prefix support to renaming indices #653

Merged

Conversation

PaulOstazeski
Copy link
Contributor

@PaulOstazeski PaulOstazeski commented Jan 23, 2025

Why:

  • When using triplex or similar
    for multi-tenancy with query prefixes, renaming tables within a
    tenant is supported, but renaming an index was not. For example:

    rename table(:foo), to: table(:bar) works
    rename index(:tablename, [:columns], name: "old_index_name"), to: "new_index_name" fails

This change addresses the need by:

  • Making indices similarly prefix-aware as tables.

Not addressed:

  • The type of the value to the :to option for rename/2 varies. When
    renaming a table, :to expects a %Table{}, when renaming an index, a string
    is expected.

Why:
* When using [triplex](https://github.com/ateliware/triplex) or similar
  for multi-tenancy with query prefixes, renaming _tables_ within a
  tenant is supported, but renaming an index was not. For example:

  `rename table(:foo), to: table(:bar)` works
  `rename index(:tablename, [:columns], name: "old_index_name"), to: "new_index_name"`

This change addresses the need by:
* Making indices similarly prefix-aware as tables.
@greg-rychlewski greg-rychlewski merged commit cc17a0d into elixir-ecto:master Jan 23, 2025
11 checks passed
@greg-rychlewski
Copy link
Member

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants