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

ActiveLibrary[Database &amp; ORM](/categories/database)

dtforce/fornettey-doctrine-migrations
=====================================

Implementation of Doctrine Migrations for Nette

v0.1.2-beta(10y ago)0620MITPHPPHP &gt;=5.6

Since Jan 22Pushed 10y ago1 watchersCompare

[ Source](https://github.com/DTForce/DoctrineMigrations)[ Packagist](https://packagist.org/packages/dtforce/fornettey-doctrine-migrations)[ RSS](/packages/dtforce-fornettey-doctrine-migrations/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (7)Versions (2)Used By (0)

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

[](#doctrine-migrations)

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

Install
-------

[](#install)

```
composer require dtforce/doctrine-migrations
```

Register extensions in `config.neon`:

```
extensions:
	migrations: DTForce\DoctrineMigrations\DI\MigrationsExtension
```

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

[](#configuration)

`config.neon` with default values

```
migrations:
	table: doctrine_migrations # database table for applied migrations
	directory: %appDir%/../migrations # directory, where all migrations are stored
	namespace: Migrations # namespace of migration classes
```

Usage
-----

[](#usage)

Open your CLI and run command (based on `DTForce\NetteConsole` integration):

```
php bin/console
```

### Migrate changes to database

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

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

```
php bin/console migrations:migrate
```

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

```
php bin/console migrations:migrate -h
```

### Create new migration

[](#create-new-migration)

To create new empty migration, just run:

```
php bin/console 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
{

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

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

}
```

As simple as that!

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

Features
--------

[](#features)

### Cleanup your directories

[](#cleanup-your-directories)

If you have over 100 migrations in one directory, it might get messy. How to make it nicer? You can create a subdirectory and move some migrations there. I would group them up by year or by purpose. All subdirectories of `directory` you set up in configuration will be scanned.

It can look like this:

```
/migrations/
   - VersionZZZ.php
/migrations/2015/
   - VersionYYY.php
/migrations/basic-data
   - VersionXXXX.php

```

### Injected migrations

[](#injected-migrations)

```
namespace Migrations;

final class Version20140801152432 extends AbstractMigration
{

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

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

	// ...

}
```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.8% 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

Unknown

Total

1

Last Release

3815d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1552179?v=4)[Jan Mareš](/maintainers/maresja1)[@maresja1](https://github.com/maresja1)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[patchlevel/event-sourcing

A lightweight but also all-inclusive event sourcing library with a focus on developer experience

207362.9k13](/packages/patchlevel-event-sourcing)

PHPackages © 2026

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