major refactoring adding vendor and customer features

This commit is contained in:
2025-10-11 09:09:25 +02:00
parent f569995883
commit dd16198276
126 changed files with 15109 additions and 3747 deletions

View File

@@ -1,9 +1,9 @@
# alembic/env.py
import os
import sys
from logging.config import fileConfig
from sqlalchemy import engine_from_config, pool
from alembic import context
# Add your project directory to the Python path
@@ -16,57 +16,77 @@ from models.database.base import Base
# Only import SQLAlchemy models, not Pydantic API models
print("[ALEMBIC] Importing database models...")
# Core 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.vendor import Vendor, VendorUser, Role
print(" ✓ Vendor models imported (Vendor, VendorUser, Role)")
except ImportError as e:
print(f" ✗ Vendor models failed: {e}")
# Product models
try:
from models.database.marketplace_product import MarketplaceProduct
print(" ✓ MarketplaceProduct model imported")
except ImportError as e:
print(f" ✗ MarketplaceProduct 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.vendor import Vendor
print(" ✓ Vendor model imported")
except ImportError as e:
print(f" ✗ Vendor model failed: {e}")
try:
from models.database.product import Product
print(" ✓ Product model imported")
except ImportError as e:
print(f" ✗ Product model failed: {e}")
# Inventory
try:
from models.database.inventory import Inventory
print(" ✓ Inventory model imported")
except ImportError as e:
print(f" ✗ Inventory model failed: {e}")
# Marketplace imports
try:
from models.database.marketplace_import_job import MarketplaceImportJob
print(" ✓ Marketplace model imported")
print(" ✓ MarketplaceImportJob model imported")
except ImportError as e:
print(f" ✗ Marketplace model failed: {e}")
print(f" ✗ MarketplaceImportJob model failed: {e}")
# Check if there are any additional models in the database directory
# Customer models (MISSING IN YOUR FILE)
try:
from models.database import auth as auth_models
print("Auth models imported")
except ImportError:
print(" - Auth models not found (optional)")
from models.database.customer import Customer, CustomerAddress
print("Customer models imported (Customer, CustomerAddress)")
except ImportError as e:
print(f" ✗ Customer models failed: {e}")
# Order models (MISSING IN YOUR FILE)
try:
from models.database import admin as admin_models
print("Admin models imported")
except ImportError:
print(" - Admin models not found (optional)")
from models.database.order import Order, OrderItem
print("Order models imported (Order, OrderItem)")
except ImportError as e:
print(f" ✗ Order models failed: {e}")
print(f"[ALEMBIC] Model import completed. Tables found: {list(Base.metadata.tables.keys())}")
print(f"[ALEMBIC] Total tables to create: {len(Base.metadata.tables)}")
# Payment models (if you have them)
try:
from models.database.payment import Payment
print(" ✓ Payment model imported")
except ImportError as e:
print(f" - Payment model not found (optional)")
# Shipping models (if you have them)
try:
from models.database.shipping import ShippingAddress
print(" ✓ Shipping model imported")
except ImportError as e:
print(f" - Shipping model not found (optional)")
print(f"\n[ALEMBIC] Model import completed.")
print(f"[ALEMBIC] Tables found: {list(Base.metadata.tables.keys())}")
print(f"[ALEMBIC] Total tables to create: {len(Base.metadata.tables)}\n")
# Alembic Config object
config = context.config