Как задать CASCADE DELETE в orm SQLModel ?
class BaseSQLModel(sqlmodel.SQLModel):
id: int = models.Field(default=None, primary_key=True, nullable=False)
class Config:
use_enum_values = True
arbitrary_types_allowed = True
class License(BaseSQLModel, table=True):
__tablename__ = 'licenses'
license_id: int = models.Field(
title='License ID',
unique=True, default=""
)
duration_day: int = models.Field(
title='Duration',
default=0
)
day_activity: datetime.datetime = models.Field(
title='Day Activity',
default_factory=datetime.datetime.utcnow,
nullable=False
)
# children: Any = relationship("CyberClub", cascade="all,delete", backref="licenses")
class CyberClub(BaseSQLModel, table=True):
__tablename__ = 'cyberclubs'
name: str = models.Field(
default=""
)
license: int = models.Field(
default=None, foreign_key="licenses.license_id"
)
spreadsheet_id: str = models.Field(
max_length=300, default="0"
)
# children1: Any = relationship("Sources", cascade="all,delete", backref="sources")
# children2: Any = relationship("Category", cascade="all,delete", backref="categories")