2026-05-22-db-migration-workflow

activetype/changelogdomain/anabatic

Changelog — DB migration workflow (2026-05-22)

TL;DR

Replaced ad-hoc db:migrate:* / db:schema:chat scripts with bootstrap + ordered migrations and Cursor db-schema-sync / typeorm-nested-entities skills.

Change

  • npm run db:bootstrapinitial_table.sql (greenfield)
  • npm run db:migrate / db:migrate:statusscript/migrations/ + schema_migrations
  • Removed per-feature migrate scripts; chat + customer constraint folded into migrations.
  • Generalized TypeORM/runner Cursor skills (no project-specific branding).

Reason

SQL and entities were drifting; multiple npm DB commands were hard to maintain.

Impact

  • Operators: db:bootstrap once, then db:migrate on every environment sync.
  • Agents: follow .cursor/rules/db-schema-sync.mdc on entity/DDL edits.

Links

  • Repo: backend-pms-dev/docs/DATABASE.md, script/migrations/README.md