yiisoft/db-migration
Database migration toolkit for Yii applications built on yiisoft/db. Create, apply, and revert schema changes with versioned migration history, console commands, configurable migration paths, and support for multiple database drivers. Track applied migrations and manage schema evolution from the com...
composer require yiisoft/db-migration. The 2.2.0 release adds a friendly error when running ./vendor/bin/yii-db-migration without a configuration file, so the first thing to do is publish/copy the config template and point it at your DB connection.yii-db-migration migrate:create <name>, inspect the generated class, then run migrate:up. If you are coming from Laravel, map Laravel’s php artisan migrate concepts onto this package’s console commands; the workflow is similar but the command vocabulary and config are Yii-specific.--db=<name> against a scratch database. 2.2.0 gives each named database its own migration history table, so verify the history table is created/used per DB rather than shared.--db=<name> and keep one migration directory per logical database where possible. This is the closest equivalent to Laravel’s per-connection migration setup, but here the history is explicitly separated.migrate:mark (#363, #373) is useful for baselining an existing schema or syncing a fresh environment to a known version. Pattern: dump/restore production schema, then run migrate:mark <version> so future migrate:up runs only apply new migrations.--transactional / --no-transactional flags (#367) when generating migrations. For databases or DDL statements where transactions are not supported or cause implicit commits, generate with --no-transactional; for normal DML migrations, keep the default transactional behavior.migrate:up --db=<name> per named database, then run application deploy steps. Because histories are separate, a failure on one DB does not corrupt another DB’s history, but your script should still stop on first failure.migrate:create with the transactional option that matches the target engine. For MySQL DDL-heavy migrations, prefer non-transactional generation to avoid confusing partial-failure behavior.migrate:mark does not execute migrations. It only moves history. Confirm the target schema actually matches the version you are marking, or later migrations may assume structures that do not exist.--db option selects a named database with its own migration history. If you omit --db, commands target the default database; do not assume they fan out across all configured databases.--transactional / --no-transactional. Existing migrations are unaffected.How can I help you explore Laravel packages today?