PHPackages                             iqomp/migrate - 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. iqomp/migrate

ActiveLibrary

iqomp/migrate
=============

Database migration that sync migrate config to database table

3.0.1(5y ago)0991MITPHP

Since Dec 20Pushed 5y ago1 watchersCompare

[ Source](https://github.com/iqomp/migrate)[ Packagist](https://packagist.org/packages/iqomp/migrate)[ RSS](/packages/iqomp-migrate/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (3)Versions (5)Used By (1)

iqomp/migrate
=============

[](#iqompmigrate)

Database migration that sync migrate config to database table. This migration method sync your migration config file with what's on database. This migration way is to store the database migration in a file config, and sync the config with your current database state. The migrations logs is not stored on each migration time file or database table, you'll have to check your repository for migrations logs.

The migration is extendable which means one migration is combined with other migration before execution. For example, module `post` already define structure for table `post`, another module ( ex: `post-publish` ) allowed to add column for table `post` on `post-publish` migration config.

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

[](#installation)

```
composer require iqomp/migrate
```

Command Line
------------

[](#command-line)

This module create new hyperf command that can be used to test, create db, sync table and config, and print out sql/script for manual execution by developer.

```
# Create database defined on config/autoload/databases.php
# if the database is not yet there.
php bin/hyperf.php iqomp:migrate db

# Start migrating for migrate config to database table.
php bin/hyperf.php iqomp:migrate start

# Compare migration config and database without executing the migration
php bin/hyperf.php iqomp:migrate test

# Compare migration config and database without executing the migration
# and print it to STD_OUT for manual execution by developer.
php bin/hyperf.php iqomp:migrate to > ./migrate.sql
```

Migration Config
----------------

[](#migration-config)

Update your `composer.json` file to include content as below:

```
{
    "extra": {
        "iqomp": {
            "migrate": "iqomp/migrate/config.php"
        }
    }
}
```

Then create new file named `iqomp/migrate/config.php` under you main module directory, fill the file with content as below:

```
