安装

    1. pip install tortoise-orm

    orm迁移工具

    1. pip install aerich
    1. > aerich -h
    2. Usage: aerich [OPTIONS] COMMAND [ARGS]...
    3. Options:
    4. -V, --version 显示版本并退出
    5. -c, --config TEXT 配置文件。(默认值:aerich.ini)
    6. --app TEXT Tortoise-ORM app 名称.
    7. -n, --name TEXT Name of section in .ini file to use for aerich config.
    8. 要用于aerich配置文件.ini文件中的名称。
    9. [default: aerich]
    10. -h, --help 显示此消息并退出.
    11. Commands:
    12. downgrade 降级到指定版本.
    13. heads 查看形成当前版本的迁移记录文件
    14. history 查看历史迁移记录
    15. init 初始化配置文件并生成根迁移目录.
    16. init-db 生成模式和生成应用迁移位置.
    17. inspectdb Introspects the database tables to standard output as...
    18. migrate 生产迁移文件.
    19. upgrade 升级到指定版本.

    初始化:

    1. aerich init -t core.db.TORTOISE_ORM --location models/migrations