Skip to content

Commit 689226e

Browse files
committed
Cascade artifact deletions in the database
1 parent b1bc1b4 commit 689226e

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

atr/models/sql.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,9 @@ class Release(sqlmodel.SQLModel, table=True):
13841384

13851385
# 1-M: Release -> [Artifact]
13861386
# M-1: Artifact -> Release
1387-
artifacts: list["Artifact"] = sqlmodel.Relationship(back_populates="release")
1387+
artifacts: list["Artifact"] = sqlmodel.Relationship(
1388+
back_populates="release", sa_relationship_kwargs={"cascade": "all, delete", "passive_deletes": True}
1389+
)
13881390

13891391
# The combination of key and version must be unique
13901392
__table_args__ = (sqlmodel.UniqueConstraint("project_key", "version", name="unique_project_version"),)

0 commit comments

Comments
 (0)