migrations.py 文件源码

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

项目:django-postgres-extra 作者: SectorLabs 项目源码 文件源码
def execute_migration(schema_editor, operations, project=None):
    """Executes the specified migration operations
    using the specified schema editor.

    Arguments:
        schema_editor:
            The schema editor to use to
            execute the migrations.

        operations:
            The migration operations to execute.

        project:
            The project state to use during the
            migrations.
    """

    project = project or migrations.state.ProjectState.from_apps(apps)

    class Migration(migrations.Migration):
        pass

    Migration.operations = operations

    executor = MigrationExecutor(schema_editor.connection)
    executor.apply_migration(
        project, Migration('eh', 'postgres_extra'))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号