- Add Catalog Functionality
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import inspect
|
||||
import logging
|
||||
import sys
|
||||
import os
|
||||
from logging.config import fileConfig
|
||||
|
||||
from flask import current_app
|
||||
@@ -19,8 +21,26 @@ config = context.config
|
||||
|
||||
# Interpret the config file for Python logging.
|
||||
# This line sets up loggers basically.
|
||||
fileConfig(config.config_file_name)
|
||||
logger = logging.getLogger('alembic.env')
|
||||
# fileConfig(config.config_file_name)
|
||||
# logger = logging.getLogger('alembic.env')
|
||||
|
||||
logging.basicConfig(
|
||||
stream=sys.stdout,
|
||||
level=logging.INFO,
|
||||
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
||||
)
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
# Reset handlers to avoid issues with Alembic overriding them
|
||||
for handler in logger.handlers:
|
||||
logger.removeHandler(handler)
|
||||
|
||||
# Add a stream handler to output logs to the console
|
||||
console_handler = logging.StreamHandler(sys.stdout)
|
||||
console_handler.setFormatter(logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s'))
|
||||
logger.addHandler(console_handler)
|
||||
logger.setLevel(logging.INFO)
|
||||
|
||||
|
||||
def get_engine():
|
||||
@@ -125,6 +145,7 @@ def run_migrations_online():
|
||||
tenants = get_tenant_ids()
|
||||
for tenant in tenants:
|
||||
try:
|
||||
os.environ['TENANT_ID'] = str(tenant)
|
||||
logger.info(f"Migrating tenant: {tenant}")
|
||||
# set search path on the connection, which ensures that
|
||||
# PostgreSQL will emit all CREATE / ALTER / DROP statements
|
||||
|
||||
Reference in New Issue
Block a user