Skip to content

Latest commit

 

History

History
37 lines (28 loc) · 1.41 KB

README.md

File metadata and controls

37 lines (28 loc) · 1.41 KB

Migrations

Build Status Downloads this Month Stable version

Migrations for Nette Framework Database (and others db layers).

Forked Clevis\Migrations, enhanced and updated for Nette Database.

Implemented drivers for:

  • Nette Database MySQL
  • Nette Database PostgreSQL

Workflow

// prepare driver
$connection = new Nette\Database\Connection('mysql:dbname=testdb', 'root', 'root');
$context = new Nette\Database\Context($connection);
$driver = new Nextras\Migrations\Drivers\MySqlNetteDbDriver($context, 'migrations');

// create controller
// choose http or cli controller
$controller = new Nextras\Migrations\Controllers\HttpController($driver);

// add groups of migration files & their dependencies on other groups
$controller->addGroup('structures', __DIR__ . '/structures');
$controller->addGroup('data', __DIR__ . '/data', ['structures']);

// add supported extension
$controller->addExtension('sql', new Nextras\Migrations\Extensions\NetteDbSql($context));

// run controller
$controller->run();