You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Migrations are a convenient way for you to alter your database in a structured and organized manner. This package adds
additional functionality for versioning your database schema and easily deploying changes to it. It is a very easy to
use and a powerful tool.
Installation
composer require cycle/migrations ^4.0
Configuration
useCycle\Migrations;
useCycle\Database;
useCycle\Database\Config;
$dbal = newDatabase\DatabaseManager(newConfig\DatabaseConfig([
'default' => 'default',
'databases' => [
'default' => [
'connection' => 'sqlite'
]
],
'connections' => [
'sqlite' => newConfig\SQLiteDriverConfig(
connection: newConfig\SQLite\MemoryConnectionConfig(),
queryCache: true,
),
]
]));
$config = newMigrations\Config\MigrationConfig([
'directory' => __DIR__ . '/../migrations/', // where to store migrations'vendorDirectories' => [ // Where to look for vendor package migrations__DIR__ . '/../vendor/vendorName/packageName/migrations/'
],
'table' => 'migrations'// database table to store migration status
'safe' => true // When set to true no confirmation will be requested on migration run.
]);
$migrator = newMigrations\Migrator(
$config,
$dbal,
newMigrations\FileRepository($config)
);
// Init migration table$migrator->configure();
You can automatically generate a set of migration files during schema compilation. In this case, you have the freedom to
alter such migrations manually before running them. To achieve that you must install
the Schema migrations generator extension.
License:
MIT License (MIT). Please see LICENSE for more information. Maintained
by Spiral Scout.