fix: sync all models with production DB schema
Check Cross-Plugin Imports / check (push) Has been cancelled
Check Cross-Plugin Imports / check (push) Has been cancelled
- Add OwnedMixin to 29 model files (78 tables that had owner_id in DB but not in model) - Add search/embedding columns to 9 model files (18 columns: search_tsv, embedding, indexed_at, content_text, content_tsv, body_tsv, company_id, deleted_at) - Fix import syntax errors in calendar/models.py, mail/models.py, notification.py, contact.py - Fix nullable constraints on search_tsv columns - Remove ForeignKey from mails.company_id (companies table not always loaded in test context) - All 36 tests pass (24 Phase J + 12 Phase K) - Models now match production DB schema
This commit is contained in:
@@ -13,6 +13,7 @@ from typing import Any
|
||||
|
||||
from sqlalchemy import (
|
||||
Computed,
|
||||
DateTime,
|
||||
Float,
|
||||
ForeignKey,
|
||||
Index,
|
||||
@@ -39,6 +40,7 @@ class Contact(Base, TenantMixin, OwnedMixin):
|
||||
"""
|
||||
|
||||
__tablename__ = "contacts"
|
||||
indexed_at: Mapped[Any] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
__table_args__ = (
|
||||
UniqueConstraint("tenant_id", "code", name="uq_contacts_tenant_code"),
|
||||
UniqueConstraint("tenant_id", "accounting_code", name="uq_contacts_tenant_accounting_code"),
|
||||
@@ -191,7 +193,7 @@ class Contact(Base, TenantMixin, OwnedMixin):
|
||||
)
|
||||
|
||||
|
||||
class ContactPerson(Base, TenantMixin):
|
||||
class ContactPerson(Base, TenantMixin, OwnedMixin):
|
||||
"""Ansprechpartner — 1:N child of a Contact.
|
||||
|
||||
Represents a person working at / associated with a company contact.
|
||||
|
||||
Reference in New Issue
Block a user