Skip to content

Commit

Permalink
Fix alembic tooling (#42)
Browse files Browse the repository at this point in the history
### Description
Autogenerate requires the `include_schemas=True` to work.

#### Issue
[ch65314](https://app.clubhouse.io/genepi/stories/space/65314)

### Test plan
Generated some migrations.
  • Loading branch information
Tony Tung authored Feb 2, 2021
1 parent 875d0c2 commit 51772ca
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion database_migrations/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def run_migrations_offline():
target_metadata=target_metadata,
literal_binds=True,
dialect_opts={"paramstyle": "named"},
include_schemas=True,
)

with context.begin_transaction():
Expand All @@ -85,7 +86,11 @@ def run_migrations_online():
connectable = create_engine(get_uri())

with connectable.connect() as connection:
context.configure(connection=connection, target_metadata=target_metadata)
context.configure(
connection=connection,
target_metadata=target_metadata,
include_schemas=True,
)

with context.begin_transaction():
context.run_migrations()
Expand Down

0 comments on commit 51772ca

Please sign in to comment.