mirror of
https://github.com/sstent/foodplanner.git
synced 2026-03-06 10:15:25 +00:00
fixing meal edit on teampltes page
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
from logging.config import fileConfig
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
from sqlalchemy import engine_from_config
|
||||
from sqlalchemy import pool
|
||||
|
||||
from alembic import context
|
||||
|
||||
# Add the project root to the Python path
|
||||
sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), '..')))
|
||||
|
||||
from app.database import Base
|
||||
|
||||
# this is the Alembic Config object, which provides
|
||||
# access to the values within the .ini file in use.
|
||||
config = context.config
|
||||
@@ -17,9 +23,7 @@ if config.config_file_name is not None:
|
||||
|
||||
# add your model's MetaData object here
|
||||
# for 'autogenerate' support
|
||||
# We create an empty metadata object since we're not using autogenerate
|
||||
# and we have explicit migration files
|
||||
target_metadata = None
|
||||
target_metadata = Base.metadata
|
||||
|
||||
# other values from the config, defined by the needs of env.py,
|
||||
# can be acquired:
|
||||
@@ -43,7 +47,7 @@ def run_migrations_offline() -> None:
|
||||
url = os.getenv('DATABASE_URL', config.get_main_option("sqlalchemy.url"))
|
||||
context.configure(
|
||||
url=url,
|
||||
target_metadata=None,
|
||||
target_metadata=target_metadata,
|
||||
literal_binds=True,
|
||||
dialect_opts={"paramstyle": "named"},
|
||||
)
|
||||
@@ -72,7 +76,7 @@ def run_migrations_online() -> None:
|
||||
with connectable.connect() as connection:
|
||||
logging.info("DEBUG: Database connection established for alembic")
|
||||
context.configure(
|
||||
connection=connection, target_metadata=None
|
||||
connection=connection, target_metadata=target_metadata
|
||||
)
|
||||
logging.info("DEBUG: Alembic context configured")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user