PHP code example of matheusbiagini / biagini-migration

1. Go to this page and download the library: Download matheusbiagini/biagini-migration library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

matheusbiagini / biagini-migration example snippets




declare(strict_types=1);

use AliceMigration\Management\Configuration\Configuration;
use AliceMigration\Migration\Migration;

#Path where your migration classes will be created
$pathMigrations = "/path/";

#Namespace that your migration classes meet, use the path namespace that you previously defined.
$namespace = 'PathNamespace';

#Here it can be customized because the configuration class expects an instance of the PDO
$pdo = new PDO('mysql:host=your_hostname;dbname=your_db;charset=UTF-8', $user, $pass);

#Creating the migration command console
$migration = new Migration(new Configuration($pdo, $pathMigrations, $namespace));
$migration->run();
shell
php example.php
shell
php example.php migrate:create
shell
php example.php migrate:run
shell
php example.php migrate:run --help
shell
php example.php migrate:revert <filename>
shell
php example.php migrate:revert MigrateVersion1546978382.php
shell
php example.php migrate:revert --help