- Updated PermissionRuleOct model to include company_id and modified unique constraint. - Updated Seal model to include company_id and modified unique constraint. - Added TYPE_CHECKING imports in reference data models for better type hinting. - Created new models for QClasses and SClasses in the a24 module. - Enhanced init_first_time.sh script for comprehensive system initialization, including Keycloak and PostgreSQL setup. - Updated documentation to reflect changes in API endpoints and database relationships.
21 lines
902 B
Python
21 lines
902 B
Python
from sqlalchemy import Integer, String, ForeignKey, PrimaryKeyConstraint, ForeignKeyConstraint, UniqueConstraint
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
from core.database import Base
|
|
|
|
|
|
class Seal(Base):
|
|
__tablename__ = "seal"
|
|
__table_args__ = (
|
|
PrimaryKeyConstraint('id', name='seal_pkey'),
|
|
ForeignKeyConstraint(['tenant_id'], ['a76.tenants.id'], name='fk_seal_tenant'),
|
|
ForeignKeyConstraint(['company_id'], ['a76.company.id'], name='fk_seal_company'),
|
|
UniqueConstraint('tenant_id', 'company_id', 'seal', name='seal_ukey'),
|
|
{"schema": "a76"}
|
|
)
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
tenant_id: Mapped[int] = mapped_column(Integer, nullable=False, index=True)
|
|
company_id: Mapped[int] = mapped_column(Integer, nullable=False, index=True)
|
|
|
|
seal: Mapped[str] = mapped_column(String(15))
|
|
|