Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

是否以后可以增加migrate方式,以方便更新数据库 #229

Open
richgene opened this issue Feb 15, 2023 · 3 comments
Open

是否以后可以增加migrate方式,以方便更新数据库 #229

richgene opened this issue Feb 15, 2023 · 3 comments

Comments

@richgene
Copy link

          请确认是否是以下情况:
  1. 在全局环境下运行项目,且此前在全局环境安装过flask-migrate
  2. 为lin-cms-flask所在环境手动添加了flask-migrate依赖

lin-cms-flask项目不推荐/兼容flask-migrate库,不兼容的原因是flask cli中定义的db命令冲突。

Originally posted by @sunlin92 in #152 (comment)

@sunlin92
Copy link
Member

在生产环境中,我没有使用过Flask-Migrate,而是编写 SQL 脚本和使用可视化数据库管理工具来处理数据库及表的更新改动,个人觉得这样更不容易出错。实现兼容的很简单,app/cli/__init__.py中有相关的绑定指令,修改db_cli = AppGroup("db")即可。

@richgene
Copy link
Author

如果兼容简单,就方便的时候加上吧,谢谢啦!~

@polo2013
Copy link

是不是可以增加一个命令:flask db update 用来比对模型和数据库表结构,自动增加表的字段、修改字段长度,加个索引?目前用下来,感觉的确是更新数据库不太方便,每次手动写sql语句也挺烦。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants