diff options
Diffstat (limited to 'db/migrations/env.py')
| -rw-r--r-- | db/migrations/env.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/db/migrations/env.py b/db/migrations/env.py index f1b3156..9c901da 100644 --- a/db/migrations/env.py +++ b/db/migrations/env.py | |||
| @@ -1,9 +1,7 @@ | |||
| 1 | from logging.config import fileConfig | 1 | from logging.config import fileConfig |
| 2 | 2 | ||
| 3 | from sqlalchemy import engine_from_config | ||
| 4 | from sqlalchemy import pool | ||
| 5 | |||
| 6 | from alembic import context | 3 | from alembic import context |
| 4 | from sqlalchemy import engine_from_config, pool | ||
| 7 | 5 | ||
| 8 | from conf import DATABASE_URL | 6 | from conf import DATABASE_URL |
| 9 | from db.models import * | 7 | from db.models import * |
| @@ -27,7 +25,7 @@ target_metadata = SQLModel.metadata | |||
| 27 | # can be acquired: | 25 | # can be acquired: |
| 28 | # my_important_option = config.get_main_option("my_important_option") | 26 | # my_important_option = config.get_main_option("my_important_option") |
| 29 | # ... etc. | 27 | # ... etc. |
| 30 | config.set_main_option('sqlalchemy.url', DATABASE_URL) | 28 | config.set_main_option("sqlalchemy.url", DATABASE_URL) |
| 31 | 29 | ||
| 32 | 30 | ||
| 33 | def run_migrations_offline() -> None: | 31 | def run_migrations_offline() -> None: |
| @@ -68,9 +66,7 @@ def run_migrations_online() -> None: | |||
| 68 | ) | 66 | ) |
| 69 | 67 | ||
| 70 | with connectable.connect() as connection: | 68 | with connectable.connect() as connection: |
| 71 | context.configure( | 69 | context.configure(connection=connection, target_metadata=target_metadata) |
| 72 | connection=connection, target_metadata=target_metadata | ||
| 73 | ) | ||
| 74 | 70 | ||
| 75 | with context.begin_transaction(): | 71 | with context.begin_transaction(): |
| 76 | context.run_migrations() | 72 | context.run_migrations() |
