PHPackages                             nkovacs/migrate-command - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. nkovacs/migrate-command

ActiveYii-extension[Database &amp; ORM](/categories/database)

nkovacs/migrate-command
=======================

This is an enhanced version of the Yii Database Migration Tool that adds module support and many more usefull features.

0.8.3(11y ago)019BSD-3-ClausePHPPHP &gt;=5.1.0

Since May 27Pushed 11y ago1 watchersCompare

[ Source](https://github.com/nkovacs/migrate-command)[ Packagist](https://packagist.org/packages/nkovacs/migrate-command)[ Docs](https://github.com/yiiext/migrate-command)[ RSS](/packages/nkovacs-migrate-command/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (1)Versions (5)Used By (0)

Extended Migration Command
--------------------------

[](#extended-migration-command)

This extension is an enhanced version of the [Yii Database Migration Tool](http://www.yiiframework.com/doc/guide/1.1/en/database.migration)that adds module support and many more usefull features. If there is anything you would like to have added, or you found a bug please [report it](https://github.com/yiiext/migrate-command/issues) on github or [contact me](mailto:mail@cebe.cc) via email.

Features
--------

[](#features)

- Module-Support (migrations are distributed in a seperate folder for every module) so you can...
- ...enable and disable Modules
- ...[add](#hh8) new module by migrating it up
- ...[remove](#hh9) a module by running its migrations down
- ...[select the modules](#hh7) you want to run migrations for in every run
- ...declare Module-dependencies (coming soon)
- ...different migration templates depending on modules (coming soon)

Resources
---------

[](#resources)

- [GIT](https://github.com/yiiext/migrate-command)
- [Yii Database Migration Documentation](http://www.yiiframework.com/doc/guide/1.1/en/database.migration)
- [Discuss](http://www.yiiframework.com/forum/index.php?/topic/22471-extension-extended-database-migration/)
- [Report a bug/request feature](https://github.com/yiiext/migrate-command/issues)

Requirements
------------

[](#requirements)

- Yii 1.1.6 or above (MigrateCommand was introduced in this version) if you copy MigrateCommand and [CDbMigration](http://www.yiiframework.com/doc/api/1.1/CDbMigration) you should be able to use this extension with any yii version.

Installation
------------

[](#installation)

- Extract the release file under `protected/extensions`.
- Add the following to your [config file](http://www.yiiframework.com/doc/guide/1.1/en/database.migration#customizing-migration-command) for yiic command:

```
'commandMap' => array(
	'migrate' => array(
		// alias of the path where you extracted the zip file
		'class' => 'application.extensions.yiiext.commands.migrate.EMigrateCommand',
		// this is the path where you want your core application migrations to be created
		'migrationPath' => 'application.db.migrations',
		// the name of the table created in your database to save versioning information
		'migrationTable' => 'tbl_migration',
		// the application migrations are in a pseudo-module called "core" by default
		'applicationModuleName' => 'core',
		// define all available modules (if you do not set this, modules will be set from yii app config)
		'modulePaths' => array(
			'admin'      => 'application.modules.admin.db.migrations',
			'user'       => 'application.modules.user.db.migrations',
			'yourModule' => 'application.any.other.path.possible',
			// ...
		),
		// you can customize the modules migrations subdirectory which is used when you are using yii module config
		'migrationSubPath' => 'migrations',
		// here you can configure which modules should be active, you can disable a module by adding its name to this array
		'disabledModules' => array(
			'admin', 'anOtherModule', // ...
		),
		// the name of the application component that should be used to connect to the database
		'connectionID'=>'db',
		// alias of the template file used to create new migrations
		'templateFile'=>'application.db.migration_template',
	),
),
```

**Please note:** if you already used MigrateCommand before, make sure to add the module column to your migrationTable:

```
ALTER TABLE `tbl_migration` ADD COLUMN `module` varchar(32) DEFAULT NULL;
UPDATE `tbl_migration` SET module='core';
```

Usage
-----

[](#usage)

\###General Usage

You can run `yiic migrate help` to see all parameters and a short example on how to use them.

The basics are explained in the [Definitive Guide to Yii](http://www.yiiframework.com/doc/guide/1.1/en/database.migration). Read them first if you haven't used database migration before. The usage of Extended Migration Command is not much different from the native one. The only command that is different is [create](http://www.yiiframework.com/doc/guide/1.1/en/database.migration#creating-migrations) where you have to additionally specify the modulename:

```
yiic migrate create modulename create_user_table

```

This creates a new migration named 'create\_user\_table' in module 'modulename'. The native usage

```
yiic migrate create create_user_table

```

creates a new migration named 'create\_user\_table' in the application(core).

\###--module Parameter

In all other commands (`up`, `down`, `history`, `new`, `to` and `mark`) you can use the parameter `--module=` where `` can be a comma seperated list of module names or a single module name. This parameter will limit the current command to affect only the specified modules. Some Examples:

```
yiic migrate new --module=core

```

This will show you all new migrations for module core and

```
yiic migrate up 5 --module=core,user

```

will migrate up the next 5 new migrations in modules core and user. If there are new migrations in other modules they will be ignored.

```
yiic migrate history --module=core,user

```

will show you which migrations have been applied for modules core and user in the past. If you do not specify a module the command behaves like the native one and does the migration for all modules.

\###add a module

Simply enable it in your config and run `yiic migrate up --module=yourModule`.

\###remove a module

Run `yiic migrate to m000000_000000 --module=yourModule`. For this to work all your migrations must have the down()-method implemented correctly.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 63.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

4

Last Release

4372d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2269242?v=4)[Nikola Kovacs](/maintainers/nkovacs)[@nkovacs](https://github.com/nkovacs)

---

Top Contributors

[![cebe](https://avatars.githubusercontent.com/u/189796?v=4)](https://github.com/cebe "cebe (38 commits)")[![nkovacs](https://avatars.githubusercontent.com/u/2269242?v=4)](https://github.com/nkovacs "nkovacs (15 commits)")[![slavcodev](https://avatars.githubusercontent.com/u/757721?v=4)](https://github.com/slavcodev "slavcodev (4 commits)")[![schmunk42](https://avatars.githubusercontent.com/u/649031?v=4)](https://github.com/schmunk42 "schmunk42 (2 commits)")[![samdark](https://avatars.githubusercontent.com/u/47294?v=4)](https://github.com/samdark "samdark (1 commits)")

---

Tags

extensionyiidatabase-migration

### Embed Badge

![Health badge](/badges/nkovacs-migrate-command/health.svg)

```
[![Health](https://phpackages.com/badges/nkovacs-migrate-command/health.svg)](https://phpackages.com/packages/nkovacs-migrate-command)
```

###  Alternatives

[yiiext/migrate-command

This is an enhanced version of the Yii Database Migration Tool that adds module support and many more usefull features.

34173.8k4](/packages/yiiext-migrate-command)[yiiext/activerecord-relation-behavior

Inspired by and put together the awesomeness of many yii extensions that aim to improve saving of related records. Comes with 100% test coverage and well structured and clean code so it can savely be used in enterprise production enviroment.

9336.5k](/packages/yiiext-activerecord-relation-behavior)[sjaakp/yii2-sortable-behavior

Sort ActiveRecords and related records in Yii2.

36144.7k](/packages/sjaakp-yii2-sortable-behavior)[sjaakp/yii2-spatial

Yii2 ActiveRecord supporting MySQL spatial data

1873.8k1](/packages/sjaakp-yii2-spatial)[nanson/yii2-postgis

Yii2-extension to work with postgis data

1851.6k](/packages/nanson-yii2-postgis)[mg-code/yii2-helpers

A collection of useful helper classes for Yii framework 2.0

2022.5k5](/packages/mg-code-yii2-helpers)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
