Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Guides creating Ghost database migrations: scaffolding the file, updating schema.ts, and testing up and down with knex-migrator.
36% 95%+59 ptsof test cases passed
Passed 21 of 22 test cases with the skill, and 8 of 22 without it.
This test ran on v1. v5 is the current version and hasn’t been tested on gemini-3.6-flash yet.
3 of 3 safety checks passed
Not used yet
Read the canonical human guidance in
docs/practices/database-migrations.md
before making a migration. This skill is the executable checklist that
accompanies it.
If you are adding a new table whose shape is still changing, consider marking it as in development instead of writing a migration yet; see "New tables still in development" in the guide.
pnpm gx generate migration <kebab-case-slug> from the repository root. IMPORTANT: do not create the migration file manually; always use this script to create the initial empty migration file. The slug must be kebab-case (e.g. add-column-to-posts).ghost/core/server/data/migrations/versions if needed, create the empty TypeScript migration file with the appropriate name, and bump the core and admin package versions to RC if this is the first migration after a release.ghost/core/server/data/migrations/utils/*. Write new migrations in TypeScript. All existing migrations, including init/, are TypeScript too.ghost/core/server/data/schema/schema.ts, and make sure it aligns with the latest changes from the migration.pnpm knex-migrator migrate --v {version directory} --forcedown(): pnpm knex-migrator rollback --v {previous version} --force, then migrate forward again.cd ghost && pnpm test:single test/integration/migrations/migration.test.js. It needs MySQL running, which pnpm dev starts.ghost/core/server/data/exporter/table-lists.js as appropriate. The consistency assertion in ghost/test/unit/server/data/exporter/index.test.js checks that every schema table is classified in the exporter lists.cd ghost && pnpm test:single test/unit/server/data/exporter/index.test.js.cd ghost && pnpm test:single test/integration/migrations/schema-sync.test.ts. For changes to fixtures, default settings, or default routes, run the database integrity test and update only the affected hash: cd ghost && pnpm test:single test/unit/server/data/schema/integrity.test.tscd ghost && pnpm test:unitSee examples.md for example migrations.
See rules.md for rules that should always be followed when creating database migrations.
Next to this one in the catalogue, plus more from the same author.