7cups / migratos
基本数据库迁移库
0.0.51
2022-05-24 09:00 UTC
Requires
- symfony/console: ^5.0
Requires (Dev)
- phpunit/phpunit: ^9.5
README
Migratos 是一个为旧项目设计的迁移库。
安装
您可以通过 composer 安装 migratos,然后您需要注册到控制台应用程序或编写自己的运行脚本。Migratos 将等待 PDO 连接实例来开始工作。在 src/Command/MigrationCommand.php
文件中包含了基于 symfony/console 的应用程序脚本。您可以审查该文件来编写自己的 cli 脚本,直到 Migratos API 文档准备就绪。
composer require 7cups/migratos
用法
您已经注册了控制台命令。
<?php require_once(__DIR__.'/vendor/autoload.php'); use SevenCupsMigratos\Command\MigrationCommand; use Symfony\Component\Console\Application; $db = new \PDO('sqlite:./test.db'); $application = new Application('7Cups Console','1.0'); $application->add(new MigrationCommand($db)); $application->run();
控制台命令
为该库存在一个预定义的 symfony 控制台应用程序。以下是命令的基本描述。同时,您将看到运行 app:migration -h
命令时相同的输出。
Usage:
app:migration [options]
Options:
-u, --up Runs newest migrations
-d, --rollback=ROLLBACK It will runs down migrations until reach the given timestamp
-i, --init First it will run base.sql and then all migrations.
-b, --base It will produce a base.sql file which contains migration table schema.
-c, --new It will produce draft migration files.
-h, --help Display help for the given command. When no command is given display help for the list command
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
贡献
欢迎 Pull requests。对于主要更改,请首先打开一个问题来讨论您想要更改的内容。
请确保根据需要更新测试。