PHP code example of kulizh / migratool
1. Go to this page and download the library: Download kulizh/migratool 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/ */
kulizh / migratool example snippets
composer
use Migratool\Migrator;
// Define migrations dir
// default is <./migration>
$migrations_dir = '/var/www/migrations/';
try {
// Create instance of Migratool
$migrator = new Migrator($pdo, $migrations_dir);
// Start script
$migrator->run();
// Echo result, you can also save it to file
// execution result is available via method ->result().
// If you pass Migratool\Result::RETURN_ERR_ONLY to the method
// it returns only failed transactions
echo "Result:\n";
foreach($migrator->result() as $file => $result)
{
echo "\t$file: $result\n";
}
} catch(\Exception $exception)
{
die($exception->getMessage() . "\n");
}