PHPackages                             rvalin/migration-bundle - 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. rvalin/migration-bundle

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

rvalin/migration-bundle
=======================

a Symfony Bundle for migrations

v1.0.1(8y ago)02.4kMITPHPPHP &gt;=5.3.9

Since Mar 14Pushed 8y ago1 watchersCompare

[ Source](https://github.com/rValin/MigrationBundle)[ Packagist](https://packagist.org/packages/rvalin/migration-bundle)[ Docs](https://github.com/rValin/MigrationBundle)[ RSS](/packages/rvalin-migration-bundle/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

RValinMigrationBundle
=====================

[](#rvalinmigrationbundle)

RValinMigrationBundle adds support of migration in symfony (2 -&gt; 4).
It provide a flexible and easy to use solution to run custom sql query, command or scripts on a project.

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

[](#installation)

1. Use [Composer](https://getcomposer.org/) to download the library

```
composer require rvalin/migration-bundle

```

2. Then add the RValinMigrationBundle to your application kernel:

```
// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new RValin\MigrationBundle\RValinMigrationBundle(),
        // ...
    );
}
```

3. Then update your database

```
php bin/console do:sc:up -f

```

Usage
-----

[](#usage)

### Generate a migration class

[](#generate-a-migration-class)

To create a migration class use the following command :

```
php bin/console migration:script:generate --bundle=FooBundle

```

You can use the option "name" to set a custom name for the migration.
Migration created with this command will be an instance of RValin\\MigrationBundle\\Tools\\MigrationInterface.

### Create your migration

[](#create-your-migration)

By default migration extend from RValin\\MigrationBundle\\Tools\\DefaultMigration.
This class provide easy solution to run sql query and command.

Your code must be in the function "execute" from the Migration class.
This function should return true of false whether the migrations worked.

#### SQL query

[](#sql-query)

You can execute sql query using the function executeSql.

```
function execute() {
    $query = 'UPDATE user SET enabled = false WHERE id = ?';
    $args = [1];

    return $this->executeSql($query, $args);
}

```

#### Command

[](#command)

You can run a command using executeCommand.
See [Symfony](https://symfony.com/doc/current/console/command_in_controller.html) document for more details.

```
function execute() {
    $commandArgs = array(
        'command' => 'swiftmailer:spool:send',
        // (optional) define the value of command arguments
        'fooArgument' => 'barValue',
        // (optional) pass options to the command
        '--message-limit' => $messages,
    );

    $this->executeCommand($commandArgs);
}

```

### Run migrations

[](#run-migrations)

To run your migrations use :

```
php bin/console migration:script:run --execute

```

If you do not use the option "execute", command and sql query won't be executed.

Once a migration has been successfully run it won't be executed again. Remove the entry from the table rvalin\_migration to run a migration again or reverse it.

You can filter the migration you run using this options:
**name** to run a specific migration
**bundle** to run the migration of a specific version
**maxVersion** Max version of the migration to run
**maxDate** Max creation date of the migration to run

### Reverse migrations

[](#reverse-migrations)

To reverse migrations use

```
php bin/console migration:script:reverse --execute

```

If you do not use the option "execute", command and sql query won't be executed.

Only migration that has been run will be reverse.

You can filter the migration you run using this options:
**name** to run a specific migration
**bundle** to run the migration of a specific version
**minVersion** Min version of the migration to run
**minDate** Min creation date of the migration to run

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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 ~3 days

Total

2

Last Release

2981d ago

### Community

Maintainers

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

---

Top Contributors

[![rValin](https://avatars.githubusercontent.com/u/15260576?v=4)](https://github.com/rValin "rValin (2 commits)")

---

Tags

symfonymigration

### Embed Badge

![Health badge](/badges/rvalin-migration-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/rvalin-migration-bundle/health.svg)](https://phpackages.com/packages/rvalin-migration-bundle)
```

###  Alternatives

[forkcms/forkcms

Fork is an open source CMS that will rock your world.

1.2k44.5k](/packages/forkcms-forkcms)[webonaute/doctrine-fixtures-generator-bundle

Generate Fixture from your existing data in your database. You can specify the Entity name and the IDs you want to import in your fixture.

67184.1k](/packages/webonaute-doctrine-fixtures-generator-bundle)[doesntmattr/mongodb-migrations-bundle

Symfony MongoDBMigrationsBundle

23484.5k1](/packages/doesntmattr-mongodb-migrations-bundle)

PHPackages © 2026

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