migrations.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:django-icekit 作者: ic-labs 项目源码 文件源码
def RenameAppInMigrationsTable(old_app_name, new_app_name):
    """
    Check whether an obsolete application name `old_app_name` is present in
    Django's `django_migrations` DB table and handle the situation as cleanly
    as possible.

    If there are migrations for the old app name, perform an UPDATE command to
    rename the app in this table so future migration runs will succeed, then
    exit with a `ObsoleteAppNameInMigrationsTableException` to indicate that
    migrations need to be re-run.

    If there are no migrations for the old app name -- e.g. the app has already
    been renamed in the table, or the old pre-rename migrations were never run
    on the DB -- then no action is performed.
    """
    return migrations.RunPython(
        _assert_and_rename_app_in_migrations(old_app_name, new_app_name)
    )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号