2017 © Pedro Peláez
 

library migration

Colibri Migration component

image

colibri-fw/migration

Colibri Migration component

  • Tuesday, April 3, 2018
  • by alek13
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Colibri Migration component

Usage without framework

  • Install the package:, (*1)

    composer require colibri-fw/migration
    
  • Create migration file in root folder of your project with the following contents:, (*2)

    #!/usr/bin/env php
    <?php
    require_once './vendor/autoload.php';
    
    use Colibri\Config\Config;
    
    Config::setBaseDir(__DIR__ . '/configs'); // <-- path to configs folder in your project
    
    require './vendor/colibri-fw/migration/bin/migration';
    

    and change configs folder to yours one., (*3)

  • Make it executable:, (*4)

    chmod +x ./migration
    
  • In your configs folder create database.php file to configure your connection, (*5)

    <?php
    
    use Colibri\Database\Type as DbType;
    
    return [
        'connection' => [
            'default' => 'mysql',
            'mysql'   => [
                'type'       => DbType::MYSQL,
                'host'       => 'localhost',
                'database'   => 'database_name',
                'user'       => 'user',
                'password'   => 'password',
                'persistent' => false,
            ],
        ],
    ];
    
  • In your configs folder create migration.php file to configure migrations:, (*6)

    <?php
    
    return [
        /**
         * Name of the table where to store executed migrations.
         */
        'table'     => 'migration',
    
        /**
         * Folder where all migration classes lives.
         */
        'folder'    => __DIR__ . '/../App/Migration',    // <-- Change to yours one
    
        /**
         * Namespace where all migration classes lives.
         */
        'namespace' => 'App\Migration',                  // <-- Change to yours one
    ];
    

The Versions