Skip to content

docs: allow hand-written schema migrations with TypeORM hash formula#3628

Merged
TaprootFreak merged 1 commit intodevelopfrom
chore/contributing-migration-fallback
Apr 27, 2026
Merged

docs: allow hand-written schema migrations with TypeORM hash formula#3628
TaprootFreak merged 1 commit intodevelopfrom
chore/contributing-migration-fallback

Conversation

@TaprootFreak
Copy link
Copy Markdown
Collaborator

Summary

Updates CONTRIBUTING.md to reflect reality after PR #3621 (entity merged without migration, fixed in #3627):

  • Keeps npm run migration as the preferred path
  • Adds an explicit fallback for contributors / AI assistants without local DB access: hand-written schema migrations are allowed if constraint names match TypeORM's deterministic algorithm
  • Documents the algorithm (extracted from node_modules/typeorm/naming-strategy/DefaultNamingStrategy.js):
    • <prefix>_ + sha1(tableName + '_' + columnNames.sort().join('_')).substring(0, N)
    • Per-prefix table (PK/FK/UQ/DF/REL/IDX/CHK with their N values)
    • Many-to-many join-table conventions (snakeCase table name, <owner>Id / <inverse>Id columns, CASCADE FKs)
  • Reminds the contributor to verify their hashes against an existing AddMros-style migration before committing

The strict ban on hand-writing didn't survive the first time someone (here: an AI assistant) couldn't run npm run migration locally. Better to document a verifiable fallback than to keep skipping migrations.

Test plan

  • Read the new section, plug mros_updated into the formula, get f6ade72c09ca260e3ce42ba0781

Reality update from PR #3621: contributors / AI assistants without
local DB setup couldn't run 'npm run migration', so they skipped the
migration entirely (David caught it after merge). The strict ban on
hand-writing didn't survive contact with that case.

The new policy keeps 'npm run migration' as the preferred path but
adds an explicit fallback: hand-written is allowed if the constraint
names match TypeORM's deterministic algorithm. Documents the formula
(prefix + sha1 substring + length per constraint type) and the
many-to-many join-table conventions.

Verifiable: every contributor can sanity-check their hashes against
existing 'AddMros'-style constraints before pushing.
@TaprootFreak TaprootFreak merged commit 17156dc into develop Apr 27, 2026
7 checks passed
@TaprootFreak TaprootFreak deleted the chore/contributing-migration-fallback branch April 27, 2026 07:51
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