db-migration
Skill4 starsChanged 2 months agoMITView on GitHub
Creates TypeORM database migrations for the Qadam Flow server. Use when the user asks to add a column, create a table, add an index, or make any schema change to the database.
6 other projects use a version of this.
Adopted by
Most recently taken up by
- TienDat-Vna/BackSpectheir own version, first seen Sep 28, 2026
- tadoEng/web-startertheir own version, first seen Aug 11, 2026
- nikandr-surkov/ai-saas-startertheir own version, first seen Jul 12, 2026
- PiloTracer/pilo.ai.logicbisontheir own version, first seen Jul 6, 2026
- viknesh20-20/claude-code-tool-kittheir own version, first seen May 2, 2026
- justnau1020/claude-ostheir own version, first seen Mar 30, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- nikandr-surkov/ai-saas-starter★ 23same name
- viknesh20-20/claude-code-tool-kit★ 7same name
- justnau1020/claude-os★ 3same name
- tadoEng/web-starter★ 2same name
- TienDat-Vna/BackSpec★ 1same name
- PiloTracer/pilo.ai.logicbison★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository15 other files it gives its agents.
- .agents/features/agents.mdAGENTS.md
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- add-endpointSkill
- add-entitySkill
- add-featureSkill
- agent-browserSkill
- designSkill
- grill-meSkill
- local-docker-deploySkill
- mcp-builderSkill
- mintlifySkill
- playwright-e2e-testingSkill
- qadam-builderSkill
- ubiquitous-languageSkill
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 3 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Create TypeORM database migrations for schema changes in the Qadam Flow server API.
- Very specific: line 22
Update the TypeORM entity file in packages/server/api/src/app/ to reflect the new schema.
- Very specific: line 48
Add breaking = false (or true if destructive)
- Very specific: line 49
Add release = '<version>' matching the upcoming release version from root package.json
- Very specific: line 50
Verify down() correctly reverses up()
- Distinctive: line 107
After the migration is generated and registered, update any TypeScript types, service files, or other code that references the changed …
- Distinctive: line 111
Always try to create non-breaking migrations if possible to allow safe rollbacks
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Qadam Flow DB Migration
Create TypeORM database migrations for schema changes in the Qadam Flow server API.
Workflow
Step 1: DETERMINE THE CHANGE
Before generating, identify:
- Which table(s) are affected
- What SQL is needed (
ADD COLUMN,CREATE TABLE,CREATE INDEX, etc.) - Whether the migration is breaking (drops columns/tables, transforms data irreversibly — cannot be rolled back safely)
- The current release version (check root
package.json→version)
Step 2: UPDATE THE ENTITY
Update the TypeORM entity file in packages/server/api/src/app/ to reflect the new schema. This ensures the CLI generation command can diff against the current state.
Array columns always use this pattern:
columnName: {
type: String,
array: true,
nullable: false,
}Step 3: GENERATE THE MIGRATION USING THE CLI
Run from packages/server/api/:
npm run db-migration -- src/app/database/migration/postgres/MigrationNameThis diffs the current entity state against the database and generates the migration file with correct SQL and timestamp.
Step 4: PATCH THE GENERATED FILE
The CLI generates a file using MigrationInterface. You must patch it to use the project's Migration interface and add required fields:
- Replace
import { MigrationInterface, QueryRunner } from "typeorm"withimport { QueryRunner } from 'typeorm'and addimport { Migration } from '../../migration' - Replace
implements MigrationInterfacewithimplements Migration - Add
breaking = false(ortrueif destructive) - Add
release = '<version>'matching the upcoming release version from rootpackage.json - Verify
down()correctly reversesup()
Example result:
import { QueryRunner } from 'typeorm'
import { Migration } from '../../migration'
export class AddMyColumn1234567890 implements Migration {
name = 'AddMyColumn1234567890'
breaking = false
release = '0.78.0'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "project" ADD COLUMN "description" text`)
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "project" DROP COLUMN "description"`)
}
}Required fields:
name = '<ExportedClassName>'— the CLI sets this; do not blank it outbreaking = false— set totrueonly if rolling back is destructiverelease = '<version>'— the upcoming release version from rootpackage.jsondown()— must reverseup()(required)
The Migration type marks breaking/release optional, but _verify.yml's
"Check new migration metadata" step (part of the required Lint + Unit Tests
check, not a separate context of its own) runs
tools/scripts/check-migration-rollback.ts (npm run check-migration-metadata)
on every PR (#445): a new migration missing name, breaking, an
invalid/missing release, or missing down() fails the build and names the
field. down() missing is actually caught earlier still, at compile time —
typeorm's MigrationInterface.down is non-optional. name matters beyond the
gate too: rollback-migrations.ts keys manifest-based rollback on it, so a
blank or mismatched one silently drops the migration from that path instead
of failing loudly — the gate also checks it matches the exported class name.
Set all four anyway; do not rely on the gate to catch it.
Step 5: REGISTER THE MIGRATION
Open packages/server/api/src/app/database/postgres-connection.ts and add the new migration class to the getMigrations() array (at the end, in chronological order):
import { AddMyColumn1234567890 } from './migration/postgres/1234567890-AddMyColumn'
// Inside getMigrations():
return [
// ... existing migrations ...
AddMyColumn1234567890,
]Step 6: UPDATE TYPES AND SERVICE CODE
After the migration is generated and registered, update any TypeScript types, service files, or other code that references the changed columns to stay in sync with the new schema.
Note:
Always try to create non-breaking migrations if possible to allow safe rollbacks
Zero errors required before the task is complete.
Using CONCURRENTLY
Qadam Flow runs against real PostgreSQL only (PGLite support was removed). When creating or dropping indexes with CONCURRENTLY, set transaction = false on the migration — PostgreSQL requires it, since CONCURRENTLY cannot run inside a transaction:
import { QueryRunner } from 'typeorm'
import { Migration } from '../../migration'
export class AddMyIndex1234567890 implements Migration {
name = 'AddMyIndex1234567890'
breaking = false
release = '0.78.0'
transaction = false // Required when using CONCURRENTLY
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE INDEX CONCURRENTLY "idx_name" ON "table" ("column")`)
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP INDEX CONCURRENTLY "idx_name"`)
}
}Quick Reference
| Field | Value |
| Migration files | packages/server/api/src/app/database/migration/postgres/ |
| Registration | packages/server/api/src/app/database/postgres-connection.ts |
Migration import | import { Migration } from '../../migration' |
| Generate command | npm run db-migration -- src/app/database/migration/postgres/MigrationName (run from packages/server/api/) |
Critical Reminders
- Always generate via CLI — never write migration SQL by hand; use
npm run db-migrationto generate from the entity diff - Never use
MigrationInterface— always patch the generated file to useMigrationfrom../../migration name,breaking,release, anddown()are mandatory — set them explicitly; a required CI check (npm run check-migration-metadata) rejects a new migration that omits one- Register in
postgres-connection.ts— migration won't run without this CONCURRENTLY— always settransaction = falsewhen using it
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

