Skip to content

Commit 4654acb

Browse files
committed
fix CASCADE DELETE with Postgres
1 parent 380a43f commit 4654acb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sqlalchemy_mptt/mixins.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ def tree_id(cls):
3939
@declared_attr
4040
def parent_id(cls):
4141
return Column("parent_id", Integer,
42-
ForeignKey('%s.id' % cls.__tablename__))
42+
ForeignKey('%s.id' % cls.__tablename__,
43+
ondelete='CASCADE'))
4344

4445
@declared_attr
4546
def parent(cls):

0 commit comments

Comments
 (0)