Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,25 @@
from sqlalchemy import engine_from_config
from sqlalchemy import pool
from dotenv import load_dotenv
import sys
import os
import model

from alembic import context

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
load_dotenv()
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))

config = context.config
section = config.config_ini_section

config.set_section_option(
section, "FAIRHUB_DATABASE_URL", str(environ.get("FAIRHUB_DATABASE_URL"))
config.set_main_option(
"sqlalchemy.url",
environ.get("FAIRHUB_DATABASE_URL")
)

# Interpret the config file for Python logging.
# This line sets up loggers basically.
if config.config_file_name is not None:
Expand All @@ -25,7 +31,8 @@
# for 'autogenerate' support
# from myapp import mymodel
# target_metadata = mymodel.Base.metadata
target_metadata = None

target_metadata = model.db.metadata

# other values from the config, defined by the needs of env.py,
# can be acquired:
Expand Down
Loading