PHPackages                             symplify/doctrine-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. symplify/doctrine-migrations

Abandoned → [https://github.com/robmorgan/phinx](/?search=https%3A%2F%2Fgithub.com%2Frobmorgan%2Fphinx)Library[Database &amp; ORM](/categories/database)

symplify/doctrine-migrations
============================

Implementation of Doctrine Migrations to Nette

v1.4.9(9y ago)05.0k1MITPHPPHP ^7.1

Since Mar 1Pushed 9y ago1 watchersCompare

[ Source](https://github.com/deprecated-packages/DeprecatedDoctrineMigrations)[ Packagist](https://packagist.org/packages/symplify/doctrine-migrations)[ RSS](/packages/symplify-doctrine-migrations/feed)WikiDiscussions master Synced 1mo ago

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

Doctrine Migrations
===================

[](#doctrine-migrations)

[![Build Status](https://camo.githubusercontent.com/6539456b17588ba7804015f248dbc63652365c99b55c492d38d3c1bf8f6cc155/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f53796d706c6966792f446f637472696e654d6967726174696f6e732e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/Symplify/DoctrineMigrations)[![Code Coverage](https://camo.githubusercontent.com/b291b3e4a9c64f541dd8f9248d8ed083c947b67242992d07238e3c59e8fa7eba/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f53796d706c6966792f446f637472696e654d6967726174696f6e732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/Symplify/DoctrineMigrations)[![Downloads this Month](https://camo.githubusercontent.com/6b310b9c0933fae1b07624912cf129ca98674cc4e3240a97831ff4deff143e3d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73796d706c6966792f646f637472696e652d6d6967726174696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/symplify/doctrine-migrations)

Implementation of [Doctrine\\Migrations](http://docs.doctrine-project.org/projects/doctrine-migrations/en/latest/) to Nette.

Install
-------

[](#install)

```
composer require symplify/doctrine-migrations
```

Register extensions in `config.neon`:

```
extensions:
	- Symplify\SymfonyEventDispatcher\Adapter\Nette\DI\SymfonyEventDispatcherExtension
	migrations: Symplify\DoctrineMigrations\DI\MigrationsExtension

	# Kdyby\Doctrine or another Doctrine integration
	doctrine: Kdyby\Doctrine\DI\OrmExtension
```

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

[](#configuration)

`config.neon` with default values

```
migrations:
	table: doctrine_migrations # database table for applied migrations
	column: version # database column for applied migrations
	directory: %appDir%/../migrations # directory, where all migrations are stored
	namespace: Migrations # namespace of migration classes
	codingStandard: tabs # or "spaces", coding style for generated classes
	versionsOrganization: null # null, "year" or "year_and_month", organizes migrations to subdirectories
```

Usage
-----

[](#usage)

Open your CLI and run command (based on `Kdyby\Console` integration):

```
php www/index.php
```

And then you should see all available commands:

[![CLI commands](cli-commands.png)](cli-commands.png)

### Migrate changes to database

[](#migrate-changes-to-database)

If you want to migrate existing migration to your database, just run migrate commmand:

```
php www/index.php migrations:migrate
```

If you get lost, just use `-h` option for help:

```
php www/index.php migrations:migrate -h
```

### Create new migration

[](#create-new-migration)

To create new empty migration, just run:

```
php www/index.php migrations:generate
```

A new empty migration will be created at your migrations directory. You can add your sql there then.

Migration that would add new role `"superadmin"` to `user_role` table would look like this:

```
namespace Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

/**
 * New role "superadmin" added.
 */
final class Version20151015000003 extends AbstractMigration
{

	public function up(Schema $schema)
	{
		$this->addSql("INSERT INTO 'user_role' (id, value, name) VALUES (3, 'superadmin', 'Super Admin')");
	}

	public function down(Schema $schema)
	{
		$this->addSql("DELETE FROM 'user_role' WHERE ('id' = 3);");
	}

}
```

Simple as that!

For further use, please check [docs in Symfony bundle](http://symfony.com/doc/current/bundles/DoctrineMigrationsBundle/index.html).

Features
--------

[](#features)

### Migrations organization

[](#migrations-organization)

If you have over 100 migrations in one directory, it might get messy. Fortunately doctrine migrations can organize your migrations to directories by year or by year and month. You can configure it in your config.neon (see above).

```
/migrations/2015/11
	- VersionXXX.php
/migrations/2015/12
	- VersionYYY.php
/migrations/2016/01
	- VersionZZZ.php

```

### Injected migrations

[](#injected-migrations)

Note: this is not really best practise, so try to use it only if there is no other way.

```
namespace Migrations;

final class Version20140801152432 extends AbstractMigration
{

	/**
	 * @inject
	 * @var Doctrine\ORM\EntityManagerInterface
	 */
	public $entityManager;

	public function up(Schema $schema)
	{
		// ...
	}

	// ...

}
```

Contributing
------------

[](#contributing)

Send [issue](https://github.com/Symplify/Symplify/issues) or [pull-request](https://github.com/Symplify/Symplify/pulls) to main repository.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 82.4% 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 ~6 days

Total

4

Last Release

3336d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/924196?v=4)[Tomas Votruba](/maintainers/TomasVotruba)[@TomasVotruba](https://github.com/TomasVotruba)

---

Top Contributors

[![TomasVotruba](https://avatars.githubusercontent.com/u/924196?v=4)](https://github.com/TomasVotruba "TomasVotruba (28 commits)")[![JanMikes](https://avatars.githubusercontent.com/u/3995003?v=4)](https://github.com/JanMikes "JanMikes (5 commits)")[![enumag](https://avatars.githubusercontent.com/u/539462?v=4)](https://github.com/enumag "enumag (1 commits)")

---

Tags

databasedoctrinemigrationsnettesymplify

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/symplify-doctrine-migrations/health.svg)

```
[![Health](https://phpackages.com/badges/symplify-doctrine-migrations/health.svg)](https://phpackages.com/packages/symplify-doctrine-migrations)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M647](/packages/sylius-sylius)[guikingone/scheduler-bundle

A Symfony bundle that allows to schedule and create repetitive tasks

114217.4k](/packages/guikingone-scheduler-bundle)[bolt/core

🧿 Bolt Core

585142.5k54](/packages/bolt-core)[bartlett/php-compatinfo-db

Reference Database of all functions, constants, classes, interfaces on PHP standard distribution and about 110 extensions

1183.0k1](/packages/bartlett-php-compatinfo-db)[concrete5/core

Concrete core subtree split

19159.3k48](/packages/concrete5-core)

PHPackages © 2026

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