PHPackages                             gozoro/yii2-sql-migrations - 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. gozoro/yii2-sql-migrations

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

gozoro/yii2-sql-migrations
==========================

Migration controller that works with sql-files ...up.sql and ...down.sql.

v1.0.2(2y ago)06MITPHPPHP &gt;=5.4.0

Since Oct 18Pushed 2y ago1 watchersCompare

[ Source](https://github.com/gozoro/yii2-sql-migrations)[ Packagist](https://packagist.org/packages/gozoro/yii2-sql-migrations)[ Docs](https://github.com/gozoro/yii2-sql-migrations)[ RSS](/packages/gozoro-yii2-sql-migrations/feed)WikiDiscussions main Synced 1mo ago

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

yii2-sql-migrations
===================

[](#yii2-sql-migrations)

Migration controller that works with sql-files `...up.sql` and `...down.sql`.

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

[](#installation)

```
composer require gozoro/yii2-sql-migrations
```

Configuration
-------------

[](#configuration)

Edit you `config/console.php`

```
...
$config = [
	...
	'components' => [
		...
	],

	'controllerMap' => [
		'migrate' => [
			'class' => 'gozoro\sql_migrations\MigrateController',
			//'migrationTable' => 'other_migration_table',
			//'migrationPath' => '@app/other_migration_path',
			//'db' => 'other_database_name'
		],
	],
	...
];

return $config
```

Usage
-----

[](#usage)

Сreate your migration files in the directory that is specified in `migrationPath`.

File naming example:

- 01\_create\_table.up.sql
- 01\_create\_table.down.sql
- 02\_insert\_data.up.sql
- 02\_insert\_data.down.sql

Run migration:

```
./yii migrate/up
```

Commands
--------

[](#commands)

```
./yii help migrate
```

```
DESCRIPTION

Migration tool using sql-files ...up.sql and ...down.sql

File naming example:

- 01_create_table.up.sql
- 01_create_table.down.sql
- 02_insert_data.up.sql
- 02_insert_data.down.sql

To sort files well, you can add as many zeros to the beginning of the file name as needed.

SUB-COMMANDS

- migrate/down          Downgrades the application by reverting old migrations.
- migrate/history       Displays the migration history.
- migrate/new           Displays the un-applied new migrations.
- migrate/redo          Redoes the last few migrations.
- migrate/to            Upgrades or downgrades till the specified version.
- migrate/up (default)  Upgrades the application by applying new migrations.

To see the detailed information about individual sub-commands, enter:

  yii help

```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~4 days

Total

3

Last Release

928d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a273abe77cdd4c74270a90320efbeb4d4dfb3ceac5b4d505ce2ccafddf1e06e0?d=identicon)[gozoro](/maintainers/gozoro)

---

Top Contributors

[![gozoro](https://avatars.githubusercontent.com/u/13768280?v=4)](https://github.com/gozoro "gozoro (12 commits)")

---

Tags

migrationsqlmigrationsyii2migratesql-migrationsql-migrationsup.sqldown.sqlsql-files

### Embed Badge

![Health badge](/badges/gozoro-yii2-sql-migrations/health.svg)

```
[![Health](https://phpackages.com/badges/gozoro-yii2-sql-migrations/health.svg)](https://phpackages.com/packages/gozoro-yii2-sql-migrations)
```

###  Alternatives

[bizley/migration

Migration generator for Yii 2.

297374.3k11](/packages/bizley-migration)[yii2tech/illuminate

Yii2 to Laravel Migration Package

11315.1k](/packages/yii2tech-illuminate)[dmstr/yii2-migrate-command

Console Migration Command with multiple paths/aliases support

31295.5k6](/packages/dmstr-yii2-migrate-command)[tmukherjee13/yii2-reverse-migration

Generate working migration classes from existing Database

2321.5k](/packages/tmukherjee13-yii2-reverse-migration)

PHPackages © 2026

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