mirror of
https://github.com/ijaric/voice_assistant.git
synced 2025-05-24 14:33:26 +00:00
feat: alembic settings
This commit is contained in:
parent
e23ee4163e
commit
7e3c912962
|
@ -5,6 +5,8 @@ from sqlalchemy import pool
|
||||||
from sqlalchemy.engine import Connection
|
from sqlalchemy.engine import Connection
|
||||||
from sqlalchemy.ext.asyncio import async_engine_from_config
|
from sqlalchemy.ext.asyncio import async_engine_from_config
|
||||||
|
|
||||||
|
import lib.app.settings as app_settings
|
||||||
|
import lib.models as models
|
||||||
from alembic import context
|
from alembic import context
|
||||||
|
|
||||||
# this is the Alembic Config object, which provides
|
# this is the Alembic Config object, which provides
|
||||||
|
@ -12,20 +14,12 @@ from alembic import context
|
||||||
config = context.config
|
config = context.config
|
||||||
|
|
||||||
# Interpret the config file for Python logging.
|
# Interpret the config file for Python logging.
|
||||||
# This line sets up loggers basically.
|
|
||||||
if config.config_file_name is not None:
|
if config.config_file_name is not None:
|
||||||
fileConfig(config.config_file_name)
|
fileConfig(config.config_file_name)
|
||||||
|
|
||||||
# add your model's MetaData object here
|
config.set_main_option("sqlalchemy.url", app_settings.settings.postgres.dsn)
|
||||||
# for 'autogenerate' support
|
|
||||||
# from myapp import mymodel
|
|
||||||
# target_metadata = mymodel.Base.metadata
|
|
||||||
target_metadata = None
|
|
||||||
|
|
||||||
# other values from the config, defined by the needs of env.py,
|
target_metadata = models.Base.metadata
|
||||||
# can be acquired:
|
|
||||||
# my_important_option = config.get_main_option("my_important_option")
|
|
||||||
# ... etc.
|
|
||||||
|
|
||||||
|
|
||||||
def run_migrations_offline() -> None:
|
def run_migrations_offline() -> None:
|
||||||
|
|
3
src/fastapi_app/lib/models/__init__.py
Normal file
3
src/fastapi_app/lib/models/__init__.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from .base_sqlalchemy import Base
|
||||||
|
|
||||||
|
__all__ = ["Base"]
|
3
src/fastapi_app/lib/models/base_sqlalchemy.py
Normal file
3
src/fastapi_app/lib/models/base_sqlalchemy.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import sqlalchemy.ext.declarative
|
||||||
|
|
||||||
|
Base = sqlalchemy.ext.declarative.declarative_base()
|
Loading…
Reference in New Issue
Block a user