PHP code example of zoltanlaca / dibi-migrations

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

    

zoltanlaca / dibi-migrations example snippets



declare(strict_types=1);

use Dibi\Connection;
use Zoltanlaca\DibiMigrations\Configuration;
use Zoltanlaca\DibiMigrations\Exceptions\ConnectionException;
use Zoltanlaca\DibiMigrations\Migrations;

  'database' => 'dibi_migrations',
        ]
    );
} catch (\Dibi\Exception $exception) {
    echo $exception->getMessage(). PHP_EOL;
    exit;
}

$config = New Configuration(
   connection: $connection,
   directory: __DIR__ . '/Migrations',
   namespace: 'Zoltanlaca\DibiMigrations\Examples\Migrations',
   tableName: 'migrations'
);

try {
    $migrations = new Migrations($config);
    $migrations->migrateUp();
} catch (ConnectionException $exception) {
    echo $exception->getMessage(). PHP_EOL;
    exit;
}

$migrations->migrateUp();

$migrations->migrateUp(20230518085154);

$migrations->migrateDown();

$migrations->migrateUp(20230518085154);