1. Go to this page and download the library: Download safronik/db-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/ */
safronik / db-migrator example snippets
namespace Safronik\DBMigrator;
use Safronik\DBMigrator\Objects\Table;
interface DBMigratorGatewayInterface
{
public function isTableExists( $table ): bool;
public function createTable( Table $table ): bool;
public function getTablesNames(): array;
public function getTableColumns( string $table ): array;
public function getTableIndexes( string $table ): array;
public function getTableConstraints( string $table ): array;
public function alterTable( $table, array $columns = [], array $indexes = [], array $constraints = [] ): bool;
public function dropTable( $table ): bool;
}
class DBMigratorGatewayInterfaceImplementation implements \Safronik\DBMigrator\DBMigratorGatewayInterface
{
// Your implementation of the interface
}
$migrator = new DBMigrator( $migrator_gateway );
$schemas = $migrator->getCurrentSchemas();