PHPackages                             filipe07/php-database-migration - 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. filipe07/php-database-migration

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

filipe07/php-database-migration
===============================

SQL migration tool forked from https://github.com/alwex/php-database-migration

0.8(7y ago)048MITPHPPHP &gt;=5.3.0

Since May 21Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Filipe07/php-database-migration)[ Packagist](https://packagist.org/packages/filipe07/php-database-migration)[ Docs](https://github.com/filipe07/php-database-migration)[ RSS](/packages/filipe07-php-database-migration/feed)WikiDiscussions master Synced 6d ago

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

PhpMySQLMigration - PHP-MySQL database migration tool
=====================================================

[](#phpmysqlmigration---php-mysql-database-migration-tool)

Project created to run migrations on multiple environments

This is a full standalone PHP tool based on [Symfony Console](http://symfony.com/doc/current/components/console). It's a fork from

Usage
-----

[](#usage)

```
$ ./bin/migrate
Console Tool

Usage:
  command [options] [arguments]

Options:
  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  help            Displays help for a command
  list            Lists commands
 migrate
  migrate:init    Create the changelog file and file directories
  migrate:addenv  Add an environment to work with php db migrate
  migrate:reset   Reset database given a clean file
  migrate:create  Create a SQL migration
  migrate:up      Execute all waiting migration up to [to] option if precised
  migrate:down    Rollback all waiting migration down to [to] option if precised
  migrate:status  Display the current status of the specified environment
  migrate:seed    Seed database with given file.

```

Installing it in your project
-----------------------------

[](#installing-it-in-your-project)

Just run composer command (don't forget to specify your bin directory)

```
composer require filipe07/php-database-migration

```

Initialization
--------------

[](#initialization)

Choose folder for migrations and configurations and creates a new database table for tracking the current database changes. Warning, all migrate commands must be executed on your root folder like `bin/migrate migrate:command...`

```
$ ./bin/migrate migrate:init

```

Adding an environment
---------------------

[](#adding-an-environment)

The first thing to do before playing with MySQL migrations is to add an environment, let's add the dev one.

```
$ ./bin/migrate migrate:addenv

```

You will be prompted to answer a series of questions about your environment, and then a config file will be saved in `.[environments]/[env].yml`.

Create a migration
------------------

[](#create-a-migration)

It is time to create our first migration file.

```
$ ./bin/migrate migrate:create

```

Migrations file are like this: -- // add table users -- Migration SQL that makes the change goes here. create table users (id integer, name text); -- @UNDO -- SQL to undo the change goes here. drop table users;

List status of migrations
-------------------------

[](#list-status-of-migrations)

View all available migrations and their status.

```
$ ./bin/migrate migrate:status [env]
+----------------+---------+------------------+--------------------+
| id             | version | applied at       | description        |
+----------------+---------+------------------+--------------------+
| 14679010838251 |         |                  | create table users |
+----------------+---------+------------------+--------------------+

```

Up and down
-----------

[](#up-and-down)

You can now up all the pending migrations. If you decide to down a migration, the last one will be downed alone to prevent mistakes. You will be asked to confirm the downgrade of your database before running the real SQL script.

```
$ ./bin/migrate migrate:up [env]

```

For development purposes, it is also possible to up a single migration without taking care of the other ones:

```
$ ./bin/migrate migrate:up [env] --only=[migrationid]

```

or migrate to specific migration (it will run all migrations, including the specified migration)

```
$ ./bin/migrate migrate:up [env] --to=[migrationid]

```

Same thing for down:

```
$ ./bin/migrate migrate:down [env] --only=[migrationid]

```

or

```
$ ./bin/migrate migrate:down [env] --to=[migrationid]

```

Seed file to database
---------------------

[](#seed-file-to-database)

If you need to seed database with given file

```
$ ./bin/migrate migrate:seed [env] {file_location}

```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

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

Total

2

Last Release

2911d ago

### Community

Maintainers

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

---

Tags

database-migrationsmysql-migrationphp-database-migrationmigrationsql

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/filipe07-php-database-migration/health.svg)

```
[![Health](https://phpackages.com/badges/filipe07-php-database-migration/health.svg)](https://phpackages.com/packages/filipe07-php-database-migration)
```

###  Alternatives

[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[php-database-migration/php-database-migration

rake and mybatis SQL migration tool

8961.2k](/packages/php-database-migration-php-database-migration)[kimai/kimai

Kimai - Time Tracking

4.6k7.4k1](/packages/kimai-kimai)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[rector/rector-src

Instant Upgrade and Automated Refactoring of any PHP code

134391.5k12](/packages/rector-rector-src)[guikingone/scheduler-bundle

A Symfony bundle that allows to schedule and create repetitive tasks

114217.4k](/packages/guikingone-scheduler-bundle)

PHPackages © 2026

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