PHP code example of mepihindeveloper / php-sql-migration

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

    

mepihindeveloper / php-sql-migration example snippets


$sqlMigration = new SqlMigration($database, [
	'schema' => 'migrations',
	'table' => 'migration',
	'path' => 'migrations'
]);

$sqlMigration->up();

#!/usr/bin/env php

declare(strict_types = 1);

use mepihindeveloper\components\{Console, ConsoleSqlMigration, Database};

=> 'pass'
]);
$database->connect();
$sqlMigration = new ConsoleSqlMigration($database, [
	'schema' => 'migrations',
	'table' => 'migration',
	'path' => 'migrations'
]);

$method = $argv[1];
$params = $argv[2] ?? null;

if (!method_exists($sqlMigration, $method)) {
	Console::writeLine("Неопознанная команда '{$method}'", Console::FG_RED);
	exit;
}

return is_null($params) ? $sqlMigration->$method() : $sqlMigration->$method($params);

src/
--- exceptions/
--- interfaces/
--- SqlMigration.php
--- ConsoleSqlMigration.php