suez/ezmigrationbundle2
Easily manage versioned database and content migrations in Symfony with this bundle, offering flexible migration classes, a CLI to run and roll back changes, and integrations for eZ Platform content structures.
composer require suez/ezmigrationbundle2
config/bundles.php (Ibexa 3 uses Symfony Flex-style registration):
Suez\EzMigrationBundle2\EzMigrationBundle2::class => ['all' => true],
Verify the actual class name — the fork may keep the original Kaliop\... namespace for BC.kaliop_migrations:; the Suez fork may rename it. Search the source for Configuration.php / Extension.php to confirm the key (likely ez_migration or suez_migration) and the migration_directory option.php bin/console list | grep -i migr
You'll see commands like kaliop:migration:create, …:migrate, …:list, …:status, and …:generate.php bin/console kaliop:migration:create --path=src/AppBundle/MigrationVersions my_first_migration
This drops a timestamped YAML file (VersionYYYYMMDDHHMMSS.yml) into the path.php bin/console kaliop:migration:migrate --path=src/AppBundle/MigrationVersions
type: contentType) plus seeding new content with type: content and references — the canonical "define-then-populate" cycle this bundle shines at.MigrationVersions/ folder inside a real bundle (not src/MigrationVersions unless --path is passed consistently every time). Files are applied in lexicographic order, so keep the Version<timestamp> prefix.- type: contentType
mode: update
identifier: article
translations: ...
- type: content
mode: create
contentType: article
parentLocationId: 2
references:
- identifier: my_article
attribute: id
- type: content
mode: update
match:
location_remote_id: ${my_article.location_remote_id}
attributes:
title: "Updated via migration"
References resolve only within the same file/run — you can't reference an entity created in a previous migration file.match: (by identifier, location_remote_id, content_remote_id) rather than raw IDs. Migrations get re-run on fresh envs; match + mode: update keeps them safe. Add --no-interaction in CI.app/MigrationVersions. Run both by passing --path twice, or by symlinking — there is no built-in multi-directory config in the original bundle.--plan lists pending versions without running them; add it to your local pre-commit hook. Use --dry-run in a deploy job to confirm no surprises.--up / --down with a version number, or --target=Version20230101... to stop at a specific point. Useful for hotfixes on production.--type=content filters: the CLI supports limiting by step type, which is handy for large content seeders where you only want to re-run the contentType schema portion.migrate in a Symfony command or a capistrano/deployer hook — call --no-interaction --env=prod. Do not run schema/content migrations inside the same artisan-style task as cache warmup; content caches need to be cleared after migrate.kaliop:migration:generate can dump existing content types (and sometimes content) into a migration YAML — the fastest way to bootstrap a baseline from a legacy eZ install.kaliop_migrations: — if that key does nothing, inspect DependencyInjection/Configuration.php in the vendor directory for the actual root node (Suez variants often use ez_migrations or suez_migrations).kaliop: even though the bundle is renamed. The fork typically preserves CLI names for backwards compatibility; grep AsCommand (or $this->setName) in Command/.--down only works if the step type supports reversal (e.g., content: delete will be attempted, but contentType: update cannot be un-done — the original schema isn't preserved). Treat migrations as forward-only in production unless you've verified the step type explicitly documents a down mode.-, containing :, or trailing whitespace break the parser. Language codes like eng-GB, and attribute values that look like numbers (e.g., phone numbers) should be quoted.${ref.field} is resolved at execution time from the migration context. If your file splits content updates across multiple migrations, the reference dies with the run. Use remote_id or identifier match rules to bridge files.match is not optional.cache:clear step in a wrapper command.composer.json require constraint and the kernel version referenced in Repository/KernelFactory-like code before upgrading.-vvv and tail var/log/prod.log — the bundle logs each step's parsed YAML payload. If a reference fails to resolve, the error is often a silent null that manifests as Entity not found on the next step; inspect the reference block carefully.type:). If you need a custom step (e.g., type: myCustomData), implement a handler extending AbstractStep (or its fork equivalent) and tag it as a service — search the fork's Resources/config/services.yml for the handler tag name (ez_migration_bundle.step_handler or similar).kaliop/ezmigrationbundle if you target eZ Platform 2.x.--env sanity check: migrations are environment-aware. Running --env=dev against a prod DB is a classic footgun; double-check DATABASE_URL before hitting migrate.How can I help you explore Laravel packages today?