This commit is contained in:
@@ -1,30 +1,28 @@
|
||||
from logging.config import fileConfig
|
||||
|
||||
from sqlalchemy import engine_from_config
|
||||
from sqlalchemy import pool, create_engine
|
||||
|
||||
from alembic import context
|
||||
from app.models import Base
|
||||
from app.config import Config
|
||||
from sqlalchemy import create_engine
|
||||
|
||||
from app.config import Config
|
||||
from app.models import Base
|
||||
|
||||
# this is the Alembic Config object, which provides
|
||||
# access to the values within the .ini file in use.
|
||||
config = context.config
|
||||
|
||||
# Set the database URL from our app config
|
||||
config.set_main_option('sqlalchemy.url', Config.SQLALCHEMY_DATABASE_URI)
|
||||
config.set_main_option("sqlalchemy.url", Config.SQLALCHEMY_DATABASE_URI)
|
||||
|
||||
# Interpret the config file for Python logging.
|
||||
# This line sets up loggers basically.
|
||||
if config.config_file_name is not None:
|
||||
fileConfig(config.config_file_name)
|
||||
# if config.config_file_name is not None:
|
||||
# fileConfig(config.config_file_name, disable_existing_loggers=False)
|
||||
|
||||
# add your model's MetaData object here
|
||||
# for 'autogenerate' support
|
||||
# from myapp import mymodel
|
||||
# target_metadata = mymodel.Base.metadata
|
||||
target_metadata = Base.metadata
|
||||
target_metadata = Base.metadata
|
||||
|
||||
|
||||
# other values from the config, defined by the needs of env.py,
|
||||
@@ -68,10 +66,7 @@ def run_migrations_online() -> None:
|
||||
connectable = create_engine(Config.SQLALCHEMY_DATABASE_URI)
|
||||
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user