docs.rs failed to build dbml_diff_mysql-0.1.5
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
dbml_diff_mysql
概述
- 对比 dbml 文件和指定数据库的差别进行输出 diff.sql
- 生成 dbml 文件的 sql
需求
功能需求
- 通过 dbml 文件和数据库的库表结构对比,生成 diff.sql
- 如果 dbml 文件中有的表,数据库中没有,则生成 create table 语句
- 如果 dbml 中的表,数据库中也有,则对比字段,生成 alter table 语句
- 只做增加字段的操作,不做删除字段的操作,和修改字段的操作
- 外键的对比
- 如果 dbml 中有的外键,数据库中没有,则生成 create foreign key 语句
结构化分析
使用
DATABASE_URL=mysql://root:root@localhost:3306/
DIFF_DATABASE_URL=mysql://root:root@localhost:3306/
DIFF_DBML_PATH=./dbml/user.dbml
DIFF_DB_NAME=rtest
DIFF_OUT_SQL_PATH=./dbml/user.sql
DIFF_RUN_SQL=false
DIFF_RUN_CMD=pause
todo
- 对比数据库的结构
- 对比 dbml 的结构
- dbml 的 args 的解析
- dbml 和 数据库对比 生成 changeItem
- changeItem 生成 sql
- 新增关联生成
- 备注的的对比生成
- 默认值的对比生成
- 备注的对比生成