是否可以更改通过迁移创建的文件的名称?像这样 `18b6422c9d3f 我更喜欢像 201705121927 这样组织使用日期时间
是否可以更改 alembic 配置来做到这一点?
最佳答案
您需要编辑alembic.ini
。
您要查找的参数是 file_template
。
来自 docs :
file_template
- this is the naming scheme used to generate new migration files. The value present is the default, so is commented out. Tokens available include:
%%(rev)s
- revision id%%(slug)s
- a truncated string derived from the revision message%%(year)d, %%(month).2d, %%(day).2d, %%(hour).2d, %%(minute).2d, %%(second).2d
- components of the create date, by defaultdatetime.datetime.now()
unless thetimezone
configuration option is also used.
默认设置为 %%(rev)s_%%(slug)s
。
关于python - 更改迁移创建的文件的名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43947307/