-
-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Description
Problem
SLM has two User models both using __tablename__ = "users":
-
Main SLM (
models/database.py:198):id = Column(Integer, primary_key=True, autoincrement=True)
-
User Management (
user_management/models/user.py:48):id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), ...)
They use different SQLAlchemy Base classes, so SQLAlchemy doesn't detect the conflict at model definition time. But when both create tables on the same database, the Integer PK users table gets created first, and then user_mfa tries to FK to it with UUID — causing a DatatypeMismatchError.
Current Workaround
Separate slm_users database for user_management (PR #1886, Docker fix).
Root Cause Fix Options
- Consolidate — Merge both into one
Usermodel with UUID PK, migrate main SLM references - Rename — Change main SLM table to
slm_adminsto avoid collision - Keep separate DBs — Accept the dual-database design as intentional architecture
Discovered During
Working on #1809 (Docker containerization) — root cause of #1854
Impact
Medium — Currently masked by separate databases. Will bite again if someone connects both models to the same DB.
Reactions are currently unavailable