Loading alembic.ini +0 −2 Original line number Diff line number Diff line Loading @@ -60,8 +60,6 @@ version_path_separator = os # Use os.pathsep. Default configuration used for ne # are written from script.py.mako # output_encoding = utf-8 sqlalchemy.url = driver://user:pass@localhost/dbname [post_write_hooks] # post_write_hooks defines scripts or Python functions that are run Loading alembic/env.py +8 −16 Original line number Diff line number Diff line from logging.config import fileConfig from pathlib import Path from sqlalchemy import engine_from_config from sqlalchemy import pool from sqlalchemy import create_engine from alembic import context Loading @@ -14,11 +14,9 @@ config = context.config if config.config_file_name is not None: fileConfig(config.config_file_name) # add your model's MetaData object here # for 'autogenerate' support # from myapp import mymodel # target_metadata = mymodel.Base.metadata target_metadata = None from clams import db, db_config target_metadata = db.Model.metadata # other values from the config, defined by the needs of env.py, # can be acquired: Loading @@ -38,7 +36,7 @@ def run_migrations_offline() -> None: script output. """ url = config.get_main_option("sqlalchemy.url") url = db_config.get_database_uri(Path("./instance")) context.configure( url=url, target_metadata=target_metadata, Loading @@ -57,16 +55,10 @@ def run_migrations_online() -> None: and associate a connection with the context. """ connectable = engine_from_config( config.get_section(config.config_ini_section, {}), prefix="sqlalchemy.", poolclass=pool.NullPool, ) connectable = create_engine(db_config.get_database_uri(Path("./instance"))) with connectable.connect() as connection: context.configure( connection=connection, target_metadata=target_metadata ) context.configure(connection=connection, target_metadata=target_metadata) with context.begin_transaction(): context.run_migrations() Loading Loading
alembic.ini +0 −2 Original line number Diff line number Diff line Loading @@ -60,8 +60,6 @@ version_path_separator = os # Use os.pathsep. Default configuration used for ne # are written from script.py.mako # output_encoding = utf-8 sqlalchemy.url = driver://user:pass@localhost/dbname [post_write_hooks] # post_write_hooks defines scripts or Python functions that are run Loading
alembic/env.py +8 −16 Original line number Diff line number Diff line from logging.config import fileConfig from pathlib import Path from sqlalchemy import engine_from_config from sqlalchemy import pool from sqlalchemy import create_engine from alembic import context Loading @@ -14,11 +14,9 @@ config = context.config if config.config_file_name is not None: fileConfig(config.config_file_name) # add your model's MetaData object here # for 'autogenerate' support # from myapp import mymodel # target_metadata = mymodel.Base.metadata target_metadata = None from clams import db, db_config target_metadata = db.Model.metadata # other values from the config, defined by the needs of env.py, # can be acquired: Loading @@ -38,7 +36,7 @@ def run_migrations_offline() -> None: script output. """ url = config.get_main_option("sqlalchemy.url") url = db_config.get_database_uri(Path("./instance")) context.configure( url=url, target_metadata=target_metadata, Loading @@ -57,16 +55,10 @@ def run_migrations_online() -> None: and associate a connection with the context. """ connectable = engine_from_config( config.get_section(config.config_ini_section, {}), prefix="sqlalchemy.", poolclass=pool.NullPool, ) connectable = create_engine(db_config.get_database_uri(Path("./instance"))) with connectable.connect() as connection: context.configure( connection=connection, target_metadata=target_metadata ) context.configure(connection=connection, target_metadata=target_metadata) with context.begin_transaction(): context.run_migrations() Loading