remodeling table models and migration to postgres
This commit is contained in:
@@ -1,18 +1,16 @@
|
||||
from logging.config import fileConfig
|
||||
|
||||
from app.schemas.models import SQLModel
|
||||
from sqlalchemy import engine_from_config
|
||||
from sqlalchemy import pool
|
||||
|
||||
from alembic import context
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
from sqlmodel import SQLModel
|
||||
from app.schemas.models import Client, Supplier, Product, Payment, Credit
|
||||
from app.core.config import settings
|
||||
|
||||
load_dotenv()
|
||||
# this is the Alembic Config object, which provides
|
||||
# access to the values within the .ini file in use.
|
||||
config = context.config
|
||||
config.set_main_option('sqlalchemy.url', str(settings.database_uri)) # type: ignore
|
||||
|
||||
# Interpret the config file for Python logging.
|
||||
# This line sets up loggers basically.
|
||||
@@ -24,7 +22,6 @@ if config.config_file_name is not None:
|
||||
# from myapp import mymodel
|
||||
# target_metadata = mymodel.Base.metadata
|
||||
target_metadata = SQLModel.metadata
|
||||
url = os.getenv("DATABASE_URI")
|
||||
|
||||
# other values from the config, defined by the needs of env.py,
|
||||
# can be acquired:
|
||||
@@ -66,7 +63,6 @@ def run_migrations_online() -> None:
|
||||
connectable = engine_from_config(
|
||||
config.get_section(config.config_ini_section, {}),
|
||||
prefix="sqlalchemy.",
|
||||
url=url,
|
||||
poolclass=pool.NullPool,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user