fix(migration): assign explicit name to custom_object_records linked index#63
Merged
fix(migration): assign explicit name to custom_object_records linked index#63
Conversation
…index The auto-generated index name `escalated_custom_object_records_linked_entity_type_linked_entity_id_index` is 73 characters — over PostgreSQL's 63-char identifier limit (NAMEDATALEN-1). Phoenix targets PostgreSQL primarily, so this would fail `mix ecto.migrate` for any user installing fresh today. Use an explicit short name (`custom_object_records_linked_idx`, 32 chars) following the same convention already used at line 61 (`name: :unique_field_entity`). Backwards compatible: the migration runs only once and is tracked in `schema_migrations`. Anyone for whom it succeeded already has the long auto-generated name; the new short name only applies to fresh installs. Anyone whose migration failed (PostgreSQL with default prefix) is unblocked.
The CI's `mix format --check-formatted` runs against PR-changed files in full. Wrapping the long `create index` line for the previous fix triggered the formatter to also wrap three pre-existing long lines in this file (`add :custom_field_id`, `add :custom_object_id`, `add :business_schedule_id`, and the `unique_index` for `custom_field_values`) — exactly the workflow's intent ("drift cleans up organically as files are touched", per `.github/workflows/lint.yml`).
No semantic change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a
mix ecto.migratefailure on PostgreSQL caused by an auto-generated index name exceeding the 63-char identifier limit.The current line generates
escalated_custom_object_records_linked_entity_type_linked_entity_id_index(73 chars). PostgreSQL caps identifiers at 63 chars (NAMEDATALEN-1), so any user with the defaultescalated_table prefix hits this on a fresh install.Same class of bug as escalated-laravel#86 / #87. Solution mirrors the existing convention already used at line 61 of this same migration (
name: :unique_field_entity).Backwards compatibility
Same logic as the Laravel fixes. Each migration runs once and is tracked in
schema_migrations:No existing install can be broken by this change.
Test plan
mix ecto.migratesucceeds on a clean PostgreSQL database with default prefix