Skip to content

docs: correct the upstream dependency for the mysql uuid-width residue - #3409

Merged
tada5hi merged 1 commit into
masterfrom
docs/typeorm-uuid-length-upstream
Aug 5, 2026
Merged

tada5hi merged 1 commit into
masterfrom
docs/typeorm-uuid-length-upstream

Conversation

@tada5hi

@tada5hi tada5hi commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #3408, which landed while this correction was still in flight.

That PR's note in .agents/conventions.md says pinning length: 36 on the 15 mysql uuid columns is parked on typeorm relaxing EntityMetadataValidator, with typeorm/typeorm#12742 as the prerequisite. That understates it, by the one part that decides whether the approach works at all.

Postgres has to ignore a length on types that do not take one in three places, each verified necessary by simulating it against postgres 18:

change status
1 do not RENDER it, PostgresDriver.createFullType open as typeorm/typeorm#12742
2 do not REJECT it, EntityMetadataValidator unwritten; this is what throws today
3 do not COMPARE it, PostgresDriver.getColumnLength unwritten

Part 3 is the deciding one. getColumnLength returns the metadata length while postgres reads back none, so with only parts 1 and 2 the column reads as changed on every boot and generates a destructive DROP COLUMN plus re-ADD: 2 statements per pass, repeating indefinitely. With all three, drift converges to 0 and the column stays native uuid.

So parts 1+2 alone would leave postgres permanently worse than today. Anyone picking this up from the conventions note needed to know that before starting.

Docs only, no code change.

Pinning `length: 36` needs three changes in typeorm, not one. Postgres must
stop rendering the length (typeorm/typeorm#12742), stop rejecting it in
`EntityMetadataValidator`, and stop comparing it in `getColumnLength`.

The third is the one that decides feasibility and is unwritten: `getColumnLength`
returns the metadata length while postgres reads back none, so with only the
first two the column is seen as changed on every boot and generates a
destructive `DROP COLUMN` plus re-`ADD`. Verified by simulating each part
against postgres 18: parts 1+2 drift 2 statements per pass indefinitely, all
three converge to 0.
Copilot AI lite review requested due to automatic review settings August 5, 2026 13:15
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@tada5hi, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 50 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: cb91f2ed-2d9c-44f2-a1e7-3047522fa0ed

📥 Commits

Reviewing files that changed from the base of the PR and between 7800966 and dd9a4cb.

📒 Files selected for processing (1)
  • .agents/conventions.md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the migration conventions documentation to more accurately describe the upstream TypeORM work required to safely pin length: 36 on MySQL UUID columns without introducing perpetual schema drift on Postgres.

Changes:

  • Expands the “Known residual drift, mysql only” note to enumerate the three required TypeORM changes (render / validate / compare) for Postgres.
  • Clarifies that PostgresDriver.getColumnLength behavior is the feasibility “decider” to avoid repeated destructive DROP COLUMN/ADD churn.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .agents/conventions.md
- Planned for `v1.0.0` final: squash the entire beta chain into a single baseline migration with a stepping-stone upgrade path (upgrade to the last beta first).
- **Constraint names that a migration spelled out must be pinned on the entity.** `migration generate` diffs the live schema against the entity metadata, so a hand-authored `CREATE INDEX IDX_auth_events_actor_id` that the model does not declare reads as drift: the next generated migration drops it and recreates it under typeorm's `IDX_<hash>`, burying whatever real change was being generated. The readable names introduced by the hand-authored beta.52/beta.53 migrations (9 foreign keys, 20 indexes, 3 unique constraints across `auth_clients`, `auth_consents`, `auth_events`, `auth_session_tokens`, `auth_trust_anchors`, `auth_user_authenticators`) are therefore declared on the entities via `@Index('IDX_...')`, `@Unique('UQ_...', [...])` and `@JoinColumn({ foreignKeyConstraintName: 'FK_...' })`. Do not drop those arguments as noise. Primary keys need no pinning: the schema builder does not compare their constraint names.
- **Known residual drift, mysql only:** 15 uuid columns were declared `varchar(36)` by those same migrations, while `@Column({ type: 'uuid' })` derives `varchar(255)` on mysql (`MysqlDriver.getColumnLength` only shortens to 36 for values typeorm generates itself). Postgres has a native `uuid` type and is unaffected. This one cannot be closed from the entity: `length` on a `uuid` column makes postgres fail at `DataSource.initialize()` with "does not support length property", and a dialect-conditional type is impossible because `migration generate` builds both dialects in one process off the same entity classes. So `migration generate` currently emits nothing on postgres and a mysql-only file whose statements are all attributable to those 15 columns. **Inspect a generated mysql migration before using it**: the drift renders as `DROP COLUMN` plus re-`ADD`, which is data loss that reads as routine. The closing move is to pin `length: 36` on those 15 columns, which needs no migration; it is parked on typeorm relaxing `EntityMetadataValidator` (typeorm/typeorm#12742 is the prerequisite, since it stops postgres rendering the invalid `uuid(36)`). Deliberately **not** closed by widening the columns to `varchar(255)`: 36 is the correct width for a uuid, so widening would remove the diff by making the schema worse (wider entries in the indexes on `auth_events.actor_id`, `auth_session_tokens.session_id` and the rest, plus a rebuild of 6 tables). Tracked in PR #3352.
- **Known residual drift, mysql only:** 15 uuid columns were declared `varchar(36)` by those same migrations, while `@Column({ type: 'uuid' })` derives `varchar(255)` on mysql (`MysqlDriver.getColumnLength` only shortens to 36 for values typeorm generates itself). Postgres has a native `uuid` type and is unaffected. This one cannot be closed from the entity: `length` on a `uuid` column makes postgres fail at `DataSource.initialize()` with "does not support length property", and a dialect-conditional type is impossible because `migration generate` builds both dialects in one process off the same entity classes. So `migration generate` currently emits nothing on postgres and a mysql-only file whose statements are all attributable to those 15 columns. **Inspect a generated mysql migration before using it**: the drift renders as `DROP COLUMN` plus re-`ADD`, which is data loss that reads as routine. The closing move is to pin `length: 36` on those 15 columns, which needs no migration (mysql already accepts a `length` on a `uuid` column and emits exactly `varchar(36)`). It is parked on postgres learning to ignore a `length` on types that do not take one, which is **three** changes in typeorm, all verified necessary by simulation: (1) do not RENDER it, `PostgresDriver.createFullType`, open as typeorm/typeorm#12742; (2) do not REJECT it, `EntityMetadataValidator`, which is what throws today; (3) do not COMPARE it, `PostgresDriver.getColumnLength`, which returns the metadata length while postgres reads back none, so without this the column drifts on **every** boot and generates a destructive `DROP COLUMN` plus re-`ADD`. Part 3 is unwritten and is the one that decides feasibility; parts 1+2 alone leave postgres permanently worse than today. Deliberately **not** closed by widening the columns to `varchar(255)`: 36 is the correct width for a uuid, so widening would remove the diff by making the schema worse (wider entries in the indexes on `auth_events.actor_id`, `auth_session_tokens.session_id` and the rest, plus a rebuild of 6 tables). Tracked in PR #3352.
@pkg-pr-new

pkg-pr-new Bot commented Aug 5, 2026

Copy link
Copy Markdown

Open in StackBlitz

authup

npm i https://pkg.pr.new/authup@3409

@authup/client-account-console

npm i https://pkg.pr.new/@authup/client-account-console@3409

@authup/client-admin-console

npm i https://pkg.pr.new/@authup/client-admin-console@3409

@authup/client-auth-console

npm i https://pkg.pr.new/@authup/client-auth-console@3409

@authup/server-core

npm i https://pkg.pr.new/@authup/server-core@3409

@authup/access

npm i https://pkg.pr.new/@authup/access@3409

@authup/client-web-kit

npm i https://pkg.pr.new/@authup/client-web-kit@3409

@authup/client-web-kit-theme

npm i https://pkg.pr.new/@authup/client-web-kit-theme@3409

@authup/client-web-nuxt

npm i https://pkg.pr.new/@authup/client-web-nuxt@3409

@authup/client-web-theme

npm i https://pkg.pr.new/@authup/client-web-theme@3409

@authup/core-http-kit

npm i https://pkg.pr.new/@authup/core-http-kit@3409

@authup/core-kit

npm i https://pkg.pr.new/@authup/core-kit@3409

@authup/core-realtime-kit

npm i https://pkg.pr.new/@authup/core-realtime-kit@3409

@authup/errors

npm i https://pkg.pr.new/@authup/errors@3409

@authup/i18n

npm i https://pkg.pr.new/@authup/i18n@3409

@authup/kit

npm i https://pkg.pr.new/@authup/kit@3409

@authup/server-adapter-kit

npm i https://pkg.pr.new/@authup/server-adapter-kit@3409

@authup/server-adapter-node

npm i https://pkg.pr.new/@authup/server-adapter-node@3409

@authup/server-adapter-socket-io

npm i https://pkg.pr.new/@authup/server-adapter-socket-io@3409

@authup/server-adapter-web

npm i https://pkg.pr.new/@authup/server-adapter-web@3409

@authup/server-kit

npm i https://pkg.pr.new/@authup/server-kit@3409

@authup/server-test-kit

npm i https://pkg.pr.new/@authup/server-test-kit@3409

@authup/specs

npm i https://pkg.pr.new/@authup/specs@3409

commit: dd9a4cb

@tada5hi
tada5hi merged commit 77c334e into master Aug 5, 2026
14 checks passed
@tada5hi
tada5hi deleted the docs/typeorm-uuid-length-upstream branch August 5, 2026 13:48
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