Add requirements.txt and guard app model imports in env.py
requirements.txt copied from shared_lib for Docker build compatibility. Alembic env.py now uses try/except for app-specific model imports so upgrade head works in Docker where only one app's code is present. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -19,10 +19,11 @@ from shared.db.base import Base
|
||||
|
||||
# Import ALL models so Base.metadata sees every table
|
||||
import shared.models # noqa: F401 User, KV, MagicLink, MenuItem, Ghost*
|
||||
import blog.models # noqa: F401 Post, Author, Tag, Snippet, TagGroup
|
||||
import market.models # noqa: F401 Product, CartItem, MarketPlace, etc.
|
||||
import cart.models # noqa: F401 Order, OrderItem, PageConfig
|
||||
import events.models # noqa: F401 Calendar, CalendarEntry, Ticket, etc.
|
||||
for _mod in ("blog.models", "market.models", "cart.models", "events.models"):
|
||||
try:
|
||||
__import__(_mod)
|
||||
except ImportError:
|
||||
pass # OK in Docker — only needed for autogenerate
|
||||
|
||||
target_metadata = Base.metadata
|
||||
|
||||
|
||||
Reference in New Issue
Block a user