18 lines
587 B
Python
18 lines
587 B
Python
from sqlalchemy import Column, String, ForeignKey
|
|
from sqlalchemy.dialects.postgresql import UUID
|
|
from .simple_base import Base
|
|
import uuid
|
|
from sqlalchemy.orm import relationship
|
|
|
|
class Organization(Base):
|
|
__tablename__ = "organization"
|
|
|
|
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
|
name_organization = Column(String(150), nullable=False)
|
|
group_id = Column(UUID(as_uuid=True), ForeignKey("group.id", ondelete="CASCADE"), nullable=False)
|
|
|
|
group = relationship("Group", backref="organizations", passive_deletes=True)
|
|
|
|
__all__ = ["Base", "Organization"]
|
|
|