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

Abandoned → [nettrine/migrations](/?search=nettrine%2Fmigrations)Library[Database &amp; ORM](/categories/database)

zenify/doctrine-migrations
==========================

Implementation of Doctrine Migrations to Nette

v4.2(9y ago)22180.3k↓25%132MITPHPPHP ^7.0

Since Aug 16Pushed 8y ago4 watchersCompare

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

READMEChangelog (8)Dependencies (13)Versions (33)Used By (2)

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

[](#doctrine-migrations)

[![Build Status](https://camo.githubusercontent.com/8af1f296719500ed9cd61c74c640b02478e53a9f7cde4a62de6507f2a0b845d0/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f5a656e6966792f446f637472696e654d6967726174696f6e732e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/Zenify/DoctrineMigrations)[![Quality Score](https://camo.githubusercontent.com/d46df8fc28c211e9f4076da2ff1768ad1ffd03993d41f532404c80e62fbec244/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f5a656e6966792f446f637472696e654d6967726174696f6e732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/Zenify/DoctrineMigrations)[![Code Coverage](https://camo.githubusercontent.com/f7700f1379ec9b84b8bce79b1e296c8795180fdb2da489206551e11370ec1969/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f5a656e6966792f446f637472696e654d6967726174696f6e732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/Zenify/DoctrineMigrations)[![Downloads this Month](https://camo.githubusercontent.com/b9edfcbb6a3d9a20f0787beccf5e1d669a7a7cd3c593331e1a762ae13f11a3c9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a656e6966792f646f637472696e652d6d6967726174696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/zenify/doctrine-migrations)[![Latest stable](https://camo.githubusercontent.com/fb1c65ddb5a8cc9b5d12f807e79f4a2a304142d49059f8784ec99ef088bbc651/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a656e6966792f646f637472696e652d6d6967726174696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/zenify/doctrine-migrations)

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

Install
-------

[](#install)

```
composer require zenify/doctrine-migrations
```

Register extensions in `config.neon`:

```
extensions:
	- Arachne\ContainerAdapter\DI\ContainerAdapterExtension
	- Arachne\EventDispatcher\DI\EventDispatcherExtension
	migrations: Zenify\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)
	{
		// ...
	}

	// ...

}
```

Testing
-------

[](#testing)

```
composer check-cs
vendor/bin/phpunit
```

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

[](#contributing)

Rules are simple:

- new feature needs tests
- all tests must pass
- 1 feature per PR

We would be happy to merge your feature then!

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity43

Moderate usage in the ecosystem

Community20

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 80% 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 ~28 days

Recently: every ~35 days

Total

32

Last Release

3428d ago

Major Versions

v0.9.2 → v1.0.02014-11-22

v1.0.0 → v2.0.02014-12-10

v2.3.5 → v3.0.02016-09-23

v3.0.0 → v4.12016-12-28

PHP version history (5 changes)v0.1.0PHP &gt;=5.4

v2.0.0PHP &gt;=5.5

v2.2.0PHP &gt;=5.6

v2.3.4PHP ^5.6|^7.0

v4.1PHP ^7.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/538058?v=4)[Milan Šulc](/maintainers/f3l1x)[@f3l1x](https://github.com/f3l1x)

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

---

Top Contributors

[![TomasVotruba](https://avatars.githubusercontent.com/u/924196?v=4)](https://github.com/TomasVotruba "TomasVotruba (4 commits)")[![martinknor](https://avatars.githubusercontent.com/u/2004222?v=4)](https://github.com/martinknor "martinknor (1 commits)")

---

Tags

databasedeprecateddoctrinemigrationsphinxphp

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[sylius/sylius

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

8.4k5.6M651](/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)
