def run_migrations_online() -> None:
    """Run migrations in 'online' mode.

    In this scenario we need to create an Engine
    and associate a connection with the context.

    """
    from biliup.database.models import DB_URL
    connectable = create_engine(
        DB_URL, poolclass=pool.NullPool,
    )

    with connectable.connect() as connection:
        context.configure(
            connection=connection,
            target_metadata=target_metadata,
            render_as_batch=True,  # 使用批处理模式，以处理 sqlite 约束变化
        )

        with context.begin_transaction():
            context.run_migrations()
Run migrations in 'online' mode.

In this scenario we need to create an Engine
and associate a connection with the context.
biliup/database/migration/env.py