简单的仅转发数据库迁移

ffmigration的Python项目详细描述


ffmigration代表“快速向前迁移”,是一个简单的数据库 迁移程序。

是一种简单而优雅的方法,它将数据库迁移保持在 跟踪wich数据库迁移的各种环境有 已经被处决了。

ffmigration是一个仅向前迁移的工具,这意味着 Ant自动回滚和应用迁移的方法。

工作原理

ffmigration在 选定的数据库以跟踪应用的迁移。这张桌子是 第一次运行时自动创建。

每次运行时,ffmigration都会查找扩展名为.sql的所有文件 在命令行中提供的迁移目录中,检查 迁移文件已应用于数据库,如果尚未应用IH 它应用于数据库并保存到migration_history

建议将所有迁移文件命名为前缀为数字 为了维持秩序。例如:

$ ls /some/migrations/dir/
0001_create_some_table.sql
0002_add_some_data.sql
0003_create_index.sql
0004_other_useful_tweaks.sql

限制

这是一个测试版软件,有一些限制:

  • By now it only works with MySQL.

安装

使用setup.py

python setup.py build
sudo python setup.py install

或者使用pip

pip install ffmigrate

命令行

$ ./ffmigration --help
Usage: ffmigration [options] database migrations_dir

Apply database migrations from migrations_dir to selected database.
migration_dir contains files with .sql extension, that are sorted
and applied.

The applied migrations are saved on a table named  'migration_history'
in the selected database

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -H HOST, --host=HOST  Database server hostname
  -u USER, --user=USER  database username
  -p                    ask for a database password
  --password=PASSWORD   database password
  -P PORT, --port=PORT  database connection port
  -q, --quiet           don't print status messages to stdout
  -l LEVEL, --level=LEVEL
                        logging level (debug,info,warning,error,critical)
  -n, --noop            Do not run commands.

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java FloatingAction按钮与RecyclerView中的CardView重叠   java如何计算CardLayout中的卡数   从远程系统上传MySQL数据库并访问Java应用程序   java调用堆栈如何处理带或不带返回类型的递归?   Springboot中的java组计数聚集   java如何在javafx textarea中使用richtextfx   获取与Mockito相关的错误时出现Java问题   java如何将JaxRS响应转换为Wiremock响应   Hadoop集群java。net ConnectionException:连接被拒绝错误   java如何加载文件私有文件类型是pem   java在元空间中的提升和加载的类   如何将系统属性传递给从HTML启动的Java小程序   java如何从网页中获取值并在主类中使用它?安卓应用   java在春天,advisor和aspect之间有什么区别?   java如何检测文件是否已重命名?   java消息驱动Bean何时使用