Conversation
… index The auto-generated index name `escalated_satisfaction_ratings_rated_by_type_rated_by_id_index` is 65 characters — over PostgreSQL's 63-char identifier limit (NAMEDATALEN-1). Lucid/Knex generates names the same way Laravel does, and Adonis supports both MySQL (which works at 65 chars but is at the 64 limit too) and PostgreSQL. Use an explicit short name (`satisfaction_ratings_rated_by_idx`, 33 chars) so the migration runs cleanly on both databases. Backwards compatible: the migration runs only once. Anyone for whom it already succeeded (MySQL or SQLite) has the long auto-generated name in their schema; the new short name only takes effect on fresh installs. Anyone whose migration failed (PostgreSQL with default prefix) is unblocked.
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 Lucid migration failure on PostgreSQL caused by an auto-generated index name exceeding the 63-char identifier limit.
The current line generates
escalated_satisfaction_ratings_rated_by_type_rated_by_id_index(65 chars). PostgreSQL caps identifiers at 63 chars (NAMEDATALEN-1) and MySQL at 64; PostgreSQL fails outright, MySQL is exactly at the limit. Any user installing fresh on PostgreSQL with the defaultescalated_table prefix hits this.Same class of bug as escalated-laravel#86 / #87.
Backwards compatibility
Each migration runs only once and is tracked in
adonis_schema:No existing install can be broken by this change.
Test plan
node ace migration:runsucceeds on a clean PostgreSQL database