1. Go to this page and download the library: Download dbschemix/migrator 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/ */
dbschemix / migrator example snippets
$migrator = new Migrator(
list: [
new Migration(
path: __DIR__ . '/migration/postgres/main',
driver: new PdoDriver(
dsn: 'pgsql:host=postgres;port=5432;dbname=main',
username: 'postgres',
password: 'postgres',
)
)
],
);
use dbschemix\pdo\Driver;
use dbschemix\core\Migration;
use dbschemix\core\Migrator;
use dbschemix\migrator\cmd\Console;
use dbschemix\migrator\tools\PrettyConsoleOutput;
'sqlite:' . __DIR__ . '/data/sqlite/db.sqlite3',
)
),
],
eventSubscribers: [
new PrettyConsoleOutput(),
],
);
Console::run($migrator);
declare(strict_types=1);
bschemix\core\{Migration, Migrator};
use dbschemix\migrator\tools\PrettyConsoleOutput;
$migrator = new Migrator(
list: [
new Migration(
path: __DIR__ . '/migration/pgsql/main',
driver: new Driver('pgsql:host=postgres;port=5432;dbname=main', 'postgres', 'postgres'),
),
],
eventSubscribers: [
new PrettyConsoleOutput(),
],
);
return $migrator;