Doctrine Migrations logo

Doctrine Migrations

Community
fatonh
doctrine-migrations

Use when changing the database schema in Symfony — generating Doctrine migrations, writing reversible up()/down(), data migrations, and deploy-safe (zero-downtime) changes. Use when the task mentions migration, schema change, ALTER TABLE, or doctrine:migrations.

Overview

Publisherfatonh
Repositorysymfony-skills
Skill namedoctrine-migrations
Stars
36
Forks
3
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by fatonh on GitHub. Read the source before you install it.

Installation

Install the Doctrine Migrations AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/fatonh/symfony-skills/tree/main/skills/doctrine-migrations
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/fatonh/symfony-skills.git /tmp/symfony-skills
mkdir -p .claude/skills
cp -r /tmp/symfony-skills/skills/doctrine-migrations .claude/skills/doctrine-migrations
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Doctrine Migrations in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Doctrine Migrations on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Doctrine Migrations is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Doctrine Migrations (Symfony)

Generate, don't hand-write the schema diff

After changing entity mapping, generate the migration from the diff, then review it:

bash
php bin/console make:migration          # diffs entities vs DB, scaffolds up()/down()
php bin/console doctrine:migrations:migrate

Never edit the schema with doctrine:schema:update --force outside local throwaway work — it bypasses migration history. Always review the generated SQL before committing; the diff tool sometimes proposes destructive or reordering changes you didn't intend.

Anatomy of a migration

php
final class Version20260620120000 extends AbstractMigration
{
    public function getDescription(): string
    {
        return 'Add status column to orders and index it';
    }

    public function up(Schema $schema): void
    {
        $this->addSql("ALTER TABLE orders ADD status VARCHAR(20) NOT NULL DEFAULT 'pending'");
        $this->addSql('CREATE INDEX idx_orders_status ON orders (status)');
    }

    public function down(Schema $schema): void
    {
        $this->addSql('DROP INDEX idx_orders_status');
        $this->addSql('ALTER TABLE orders DROP status');
    }
}
  • down() must reverse up() exactly — don't leave it empty or throw. A migration you can't roll back is a deploy you can't undo.
  • One logical change per migration — don't bundle unrelated DDL.
  • Keep migrations immutable once merged/deployed. Never edit a migration that has run anywhere; write a new one.

Zero-downtime / deploy-safe changes

When the app is running during deploy, schema changes must be backward compatible with the currently deployed code.

ChangeSafe?Do this
Add nullable column✅Single migration
Add NOT NULL column⚠️Add nullable → backfill → set NOT NULL (3 steps, often 2 deploys)
Rename column❌Add new → copy → deploy code using new → drop old
Drop column⚠️Deploy code that stops using it first, then drop
Add index on large table⚠️CREATE INDEX CONCURRENTLY (Postgres) — outside a transaction
php
// Postgres concurrent index — must run outside the migration's wrapping transaction
public function up(Schema $schema): void
{
    $this->addSql('CREATE INDEX CONCURRENTLY idx_orders_created_at ON orders (created_at)');
}

public function isTransactional(): bool
{
    return false; // CONCURRENTLY can't run inside a transaction
}

The expand/contract pattern: expand the schema (additive, both old and new code work), deploy code, then contract (remove the old) in a later migration.

Data migrations

Transforming rows belongs in up() too, but keep it set-based SQL, not entity hydration (the entity classes may not match the historical schema):

php
public function up(Schema $schema): void
{
    $this->addSql("UPDATE orders SET status = 'pending' WHERE status IS NULL");
    $this->addSql('ALTER TABLE orders ALTER COLUMN status SET NOT NULL');
}

Don't use App\Entity\Order inside a migration — entities evolve, migrations are frozen in time. For heavy backfills that can't be one statement, prefer a separate idempotent console command run during deploy.

Conventions

  • One migration file per PR that changes the schema; commit it alongside the entity change.
  • Verify up() then down() then up() runs clean locally before pushing.
  • Name migrations by what they do (via getDescription()), since the class name is just a timestamp.
  • In CI, fail the build if make:migration would produce a non-empty diff (schema and entities are out of sync).
bash
php bin/console doctrine:migrations:migrate --dry-run   # print SQL without executing
php bin/console doctrine:schema:validate                 # entities ⇄ DB in sync?

Gotchas

  • Agent runs doctrine:schema:update --force instead of generating a migration — always use make:migration + migrate.
  • Agent leaves down() empty or throwing — make it reverse up().
  • Agent adds a NOT NULL column with no default to a populated table — add nullable, backfill, then enforce NOT NULL.
  • Agent edits an already-deployed migration — migrations are immutable; write a new one.
  • Agent imports entity classes inside a migration — use raw SQL; entities don't match historical schemas.
  • Agent renames a column in one step during a live deploy — use expand/contract.
  • Agent creates an index on a big Postgres table without CONCURRENTLY (+ isTransactional(): false) — it locks the table.
  • Agent bundles several unrelated schema changes into one migration — keep them separate.

Frequently asked questions

What does the Doctrine Migrations AI skill do?

Use when changing the database schema in Symfony — generating Doctrine migrations, writing reversible up()/down(), data migrations, and deploy-safe (zero-downtime) changes. Use when the task mentions migration, schema change, ALTER TABLE, or doctrine:migrations.

Why use Doctrine Migrations on TypingMind?

Because you install it once and use it with any model. Doctrine Migrations is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Doctrine Migrations in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/fatonh/symfony-skills/tree/main/skills/doctrine-migrations. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Doctrine Migrations?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Doctrine Migrations?

As many as you like. As long as a model supports skills, you can use Doctrine Migrations with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Doctrine Migrations AI skill free?

Yes. It is published on GitHub by fatonh under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇