PHP code example of bixev / migrations

1. Go to this page and download the library: Download bixev/migrations 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/ */

    

bixev / migrations example snippets





$migrationsStore = new \Bixev\Migrations\VersionStore\MysqlVersionStore();
$migrationsStore->setDb(new PDO(''), 'table_name');

$migrationsApi = new  \Bixev\Migrations\API($migrationsStore);

$migrationsApi->setUpdater('php', new \Bixev\Migrations\Updater\PhpUpdater());
$mysqlUpdater = new \Bixev\Migrations\Updater\MysqlUpdater();
$mysqlUpdater->setQueryExecutor(
    function ($query) use ($pdoMysql) {
        $replacements = ['${DEFAULT_ENGINE}' => 'pouet'];
        $query        = str_replace(array_keys($replacements), array_values($replacements), $query);
        $pdoMysql->query($query);
    }
);
$migrationsApi->setUpdater('sql', $mysqlUpdater);

$migrationsApi->update('namespace', 'update/directory');

$logger = new \Bixev\LightLogger\StdLogger();
$migrationsStore = new \Bixev\Migrations\VersionStore\MysqlVersionStore($logger);
$migrationsApi = new  \Bixev\Migrations\API($migrationsStore, $logger);