Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coming from Doctrine/Migrations #97

Open
VincentLanglet opened this issue Aug 12, 2024 · 1 comment
Open

Coming from Doctrine/Migrations #97

VincentLanglet opened this issue Aug 12, 2024 · 1 comment

Comments

@VincentLanglet
Copy link

HI,

I just discovered this lib and it seems great.
But I already have doctrine migrations.

What could be great would be having some doc about how to migrate from Doctrine to this lib

  • How to rewrite existing migrations (if needed)
  • How to migrate the existing migrations table
  • How to migrate some config

(Also the rollup command from doctrine is nice, having the same here would be great).

@janedbal
Copy link
Member

I opened our old MR where we did exactly this and here are some core steps we did:

  • Migrated existing migrations by this simple replace
    • This assumes empty down method and very basic bodies
  • Dropped old migrations table from doctrine/migration and created & filled new table via:
    • bin/console migration:init
    • bin/console migration:skip
  • Replaced CI runs
    • bin/console doctrine:migrations:migrate -> bin/console migration:run both
    • bin/console doctrine:migrations:status -> bin/console migration:check
  • Registered new services:
  ShipMonk\Doctrine\Migration\MigrationCheckCommand:
  ShipMonk\Doctrine\Migration\MigrationGenerateCommand:
  ShipMonk\Doctrine\Migration\MigrationInitCommand:
  ShipMonk\Doctrine\Migration\MigrationRunCommand:
  ShipMonk\Doctrine\Migration\MigrationSkipCommand:
  ShipMonk\Doctrine\Migration\MigrationService:
    $migrationsDir: "%kernel.project_dir%/migrations"
    $migrationClassNamespace: 'SHipMonk\Migration'
    $migrationClassPrefix: 'Version'
    $templateFilePath: "%kernel.project_dir%/migrations/migration.template"

  • Changed the template like this:
    • image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants