Synthèse automatique
Guide la création d'une migration de base de données dans Ghost, depuis la génération du fichier vide jusqu'à la mise à jour de schema.js, aux tests de rollback et aux suites de tests obligatoires.
Points forts
- Impose la génération du fichier via `pnpm migrate:create` plutôt qu'une création manuelle, et signale le passage des versions core/admin en RC.
- Couvre la boucle complète : migration avant, test du `down()` par rollback, puis test d'intégration incluant l'idempotence.
- Rappelle les fichiers annexes faciles à oublier (schema.js, table-lists.js de l'exporter) et les tests ciblés associés.
- Exige explicitement une validation sur MySQL et sur SQLite.
Limites
- Très lié à l'arborescence du monorepo Ghost (chemins ghost/core, knex-migrator, scripts pnpm) et non réutilisable ailleurs.
- Renvoie les patterns de code et les règles à docs/practices/database-migrations.md, rules.md et examples.md, non inclus dans ce fichier.
- N'aborde pas la performance des backfills ni les précautions sur les tables volumineuses.
À utiliser dès qu'une modification de Ghost touche le schéma : nouvelle table, colonne, index, setting ou mise à jour de données nécessitant un fichier de migration dans ghost/core.
À ne pas utiliser pour un projet autre que Ghost, ni pour des changements sans impact sur le schéma (API, thème, interface).
Analyse de sécurité
SûrThis is a documentation/checklist skill for creating Ghost CMS database migrations. All commands are standard repo-local tooling (pnpm migrate:create, knex-migrator, tests) with no network exfiltration, destructive filesystem operations, obfuscated payloads, or safety-disabling instructions. No allowed-tools are declared and referenced files are relative in-repo docs.
Aucun point d'attention détecté
Comment cette analyse est faiteExemples
Add a nullable `featured_at` datetime column to the Ghost posts table and update schema.js to match.Add a new `members_anniversary_enabled` setting to Ghost — it needs a database migration.Write a migration that backfills the `visibility` column on the posts table for existing rows, and test the rollback.name: Create database migration description: 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. Use this skill whenever the task involves modifying Ghost's database schema — including adding, removing, or renaming columns or tables, adding new settings, creating indexes, updating data, or any change that requires a migration file in ghost/core. Also use when the user references schema.js, knex-migrator, the migrations directory, or asks to "add a field" or "add a column" to any Ghost model/table. Even if the user frames it as a feature or Linear issue, if the implementation requires a schema change, this skill applies.
Create Database Migration
Read the canonical human guidance in
docs/practices/database-migrations.md
before making a migration. This skill is the executable checklist that
accompanies it.
Instructions
- Create a new, empty migration file:
cd ghost/core && pnpm migrate:create <kebab-case-slug>. 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). - The above command will create a new directory in
ghost/core/core/server/data/migrations/versionsif needed, create the empty 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. - 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
ghost/core/core/server/data/schema/schema.js, and make sure it aligns with the latest changes from the migration. - Test the migration manually:
cd ghost/core && pnpm knex-migrator migrate --v {version directory} --force - Roll the migration back to test
down():cd ghost/core && pnpm knex-migrator rollback --v {previous version} --force, then migrate forward again. - Run the migration integration test, which covers initialization, rollback, forward migration, and idempotency:
cd ghost/core && pnpm test:single test/integration/migrations/migration.test.js. Migrations must pass the database-backed suites against both MySQL and SQLite. - If adding or dropping a table, update
ghost/core/core/server/data/exporter/table-lists.jsas appropriate. The consistency assertion inghost/core/test/unit/server/data/exporter/index.test.jschecks that every schema table is classified in the exporter lists. - Run the focused exporter unit test when the table lists change:
cd ghost/core && pnpm test:single test/unit/server/data/exporter/index.test.js. - Run the schema integrity test, and update the hash:
cd ghost/core && pnpm test:single test/unit/server/data/schema/integrity.test.js - Run unit tests in Ghost core, and iterate until they pass:
cd ghost/core && pnpm test:unit
Examples
See examples.md for example migrations.
Rules
See rules.md for rules that should always be followed when creating database migrations.
Du fichier au premier essai
Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.
Consulter la source et ses fichiers annexesCe téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.
1. Télécharger le fichier
Télécharger SKILL.mdDepuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/create-database-migration-mte1livc/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.
Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.
mkdir -p '.skill-downloads/create-database-migration-mte1livc' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/create-database-migration-mte1livc/download' --output '.skill-downloads/create-database-migration-mte1livc/SKILL.md.part' && mv '.skill-downloads/create-database-migration-mte1livc/SKILL.md.part' '.skill-downloads/create-database-migration-mte1livc/SKILL.md'2. Vérifier les prérequis
Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.
Aucune section de prérequis reconnue dans ce fichier. Cela ne signifie pas qu’il est autonome : les bibliothèques, outils et accès peuvent être cités ailleurs dans le contenu ou dans le dépôt source.
Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.
3. Charger la skill
Le fichier ne fournit pas un en-tête name/description exploitable pour cette procédure native. Le téléchargement reste disponible pour lecture ; utilisez le mode manuel ci-dessous.
Mode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.
4. Faire un premier essai
Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :
Lis .skill-downloads/create-database-migration-mte1livc/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.
Bonnes pratiques React Hook Form
Developpement
Maîtrisez React Hook Form : évitez les anti-patterns, gérez les abonnements, et traitez correctement reset, dirty state et entrées contrôlées.
Migration Emotion vers Mantine
Developpement
Migrer les styled-components Emotion vers des composants Mantine avec style props et modules CSS. Pour convertir .styled.tsx ou supprimer les imports @emotion.
Détecteur de dérive de périmètre
Developpement
Analyse les diffs git par rapport à une intention pour détecter la dérive de périmètre, fichiers non liés et PR trop larges, puis suggère de garder, diviser ou justifier.