Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Automatic migration generation

License

NotificationsYou must be signed in to change notification settings

cycle/migrations

Latest Stable VersionBuild StatusScrutinizer Code QualityCodecov

Migrations are a convenient way for you to alter your database in a structured and organized manner. This package addsadditional functionality for versioning your database schema and easily deploying changes to it. It is a very easy touse 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();

Running

while (($migration =$migrator->run()) !==null) {echo'Migrate' .$migration->getState()->getName();}

Generate Migrations

You can automatically generate a set of migration files during schema compilation. In this case, you have the freedom toalter such migrations manually before running them. To achieve that you must installtheSchema migrations generator extension.

License:

MIT License (MIT). Please seeLICENSE for more information. MaintainedbySpiral Scout.

About

Automatic migration generation

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors19


[8]ページ先頭

©2009-2025 Movatter.jp