diff --git a/alembic.ini b/alembic.ini index 77a55b7..21a0cf7 100644 --- a/alembic.ini +++ b/alembic.ini @@ -3,6 +3,7 @@ [alembic] # path to migration scripts script_location = migrations +project = learn_sql_model # template used to generate migration file names; The default value is %%(rev)s_%%(slug)s # Uncomment the line below if you want the files to be prepended with date and time diff --git a/migrations/env.py b/migrations/env.py index cd73f61..38bed18 100644 --- a/migrations/env.py +++ b/migrations/env.py @@ -54,6 +54,7 @@ def run_migrations_offline() -> None: target_metadata=target_metadata, literal_binds=True, dialect_opts={"paramstyle": "named"}, + version_table=f'{config.get_main_option("project")}_alembic_version', ) with context.begin_transaction(): @@ -74,7 +75,12 @@ def run_migrations_online() -> None: ) with connectable.connect() as connection: - context.configure(connection=connection, target_metadata=target_metadata) + context.configure( + connection=connection, + target_metadata=target_metadata, + render_as_batch=True, + version_table=f'{config.get_main_option("project")}_alembic_version', + ) with context.begin_transaction(): context.run_migrations()