Claude-skill-registry Create database migration
Create a database migration to add a table, add columns to an existing table, add a setting, or otherwise change the schema of Ghost's MySQL database.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/create-database-migration" ~/.claude/skills/majiayu000-claude-skill-registry-create-database-migration-712631 && rm -rf "$T"
manifest:
skills/data/create-database-migration/SKILL.mdsource content
Create Database Migration
Instructions
- Change directories into
:ghost/corecd ghost/core - Create a new, empty migration file using slimer:
. IMPORTANT: do not create the migration file manually; always use slimer to create the initial empty migration file.slimer migration <name-of-database-migration> - The above command will create a new directory in
if needed, and create the empty migration file with the appropriate name.ghost/core/core/server/data/migrations/versions - Update the migration file with the changes you want to make in the database, following the existing patterns in the codebase. Where appropriate, prefer to use the utility functions in
.ghost/core/core/server/data/migrations/utils/* - Update the schema definition file in
, and make sure it aligns with the latest changes from the migration.ghost/core/core/server/data/schema/schema.js - Test the migration manually:
yarn knex-migrator migrate --v {version directory} --force - If adding or dropping a table, update
as appropriate.ghost/core/core/server/data/exporter/table-lists.js - Run the schema integrity test, and update the hash:
yarn test:single test/unit/server/data/schema/integrity.test.js - Run unit tests in Ghost core, and iterate until they pass:
cd ghost/core && yarn test:unit
Examples
See examples.md for example migrations.
Rules
See rules.md for rules that should always be followed when creating database migrations.