Skip to content

fix(migration): assign explicit name to satisfaction_ratings rated_by index#69

Merged
mpge merged 1 commit intomainfrom
fix/satisfaction-ratings-index-name
May 6, 2026
Merged

fix(migration): assign explicit name to satisfaction_ratings rated_by index#69
mpge merged 1 commit intomainfrom
fix/satisfaction-ratings-index-name

Conversation

@mpge
Copy link
Copy Markdown
Member

@mpge mpge commented May 6, 2026

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 default escalated_ 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:

  1. Migration already succeeded (MySQL or SQLite): the user's schema has the long auto-generated name. Migration won't re-run, so the new explicit name only matters for fresh installs.
  2. Migration failed (default prefix on PostgreSQL): nothing was created. The fix unblocks them.

No existing install can be broken by this change.

Test plan

  • node ace migration:run succeeds on a clean PostgreSQL database
  • CI passes

… 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.
@mpge mpge merged commit 4f26234 into main May 6, 2026
3 checks passed
@mpge mpge deleted the fix/satisfaction-ratings-index-name branch May 6, 2026 01:36
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.

1 participant