shevaua/db-mysql-migrations

There is no license information available for the latest version (v1.0.0) of this package.

DB migrations for mysql

v1.0.0 2019-07-24 06:44 UTC

This package is auto-updated.

Last update: 2025-05-25 08:48:20 UTC


README

  1. You need an array with configuration params. Ex: /config/sample.php

     $params = [
         'folder' => 'path_to_folder',
         'ignore' => [
             // list of ignored subpathes
         ],
         ...
     ];
    
  2. Create a config instance like this one

     $config = new Shevaua\DB\Mysql\Migrations\Config($params);
    
  3. Create a controller instance

     $controller = new Shevaua\DB\Mysql\Migrations\MigrationController($config);
    
  4. Let's start

     /** Execute all new migrations */
     $controller->migrate();
    
     /** Rollback for one step back */
     $controller->rollback();
    

Migration table

Migration table contains next columns:

  • id: int
  • group: int
  • name: varchar
  • migrated_at: timestamp

Advanced

There is a way to migrate/rollback migrations step by step

/** Execute all new migrations */
$controller->migrate($limit = 1);

/** Rollback for one step back */
$controller->rollback($limit = 1);

CHANGELOG

click here

CONTRIBUTE

click here