Alembic configuration

This commit is contained in:
2025-09-21 16:03:44 +02:00
parent b47c88b24b
commit 09b92eceb8
10 changed files with 695 additions and 281 deletions

View File

@@ -12,6 +12,56 @@ sys.path.append(os.path.dirname(os.path.dirname(__file__)))
from app.core.config import settings
from models.database.base import Base
# === IMPORTANT: Import all your DATABASE models here ===
# Only import SQLAlchemy models, not Pydantic API models
print("[ALEMBIC] Importing database models...")
try:
from models.database.user import User
print(" ✓ User model imported")
except ImportError as e:
print(f" ✗ User model failed: {e}")
try:
from models.database.product import Product
print(" ✓ Product model imported")
except ImportError as e:
print(f" ✗ Product model failed: {e}")
try:
from models.database.stock import Stock
print(" ✓ Stock model imported")
except ImportError as e:
print(f" ✗ Stock model failed: {e}")
try:
from models.database.shop import Shop, ShopProduct
print(" ✓ Shop models imported")
except ImportError as e:
print(f" ✗ Shop models failed: {e}")
try:
from models.database.marketplace import MarketplaceImportJob
print(" ✓ Marketplace model imported")
except ImportError as e:
print(f" ✗ Marketplace model failed: {e}")
# Check if there are any additional models in the database directory
try:
from models.database import auth as auth_models
print(" ✓ Auth models imported")
except ImportError:
print(" - Auth models not found (optional)")
try:
from models.database import admin as admin_models
print(" ✓ Admin models imported")
except ImportError:
print(" - Admin models not found (optional)")
print(f"[ALEMBIC] Model import completed. Tables found: {list(Base.metadata.tables.keys())}")
print(f"[ALEMBIC] Total tables to create: {len(Base.metadata.tables)}")
# Alembic Config object
config = context.config