Why not seeing ondelete='xxx', and onupdate='xxx' in alembic migration script?

82 views
Skip to first unread message

junepeach

unread,
Dec 5, 2012, 2:56:09 PM12/5/12
to sqlal...@googlegroups.com
I defined several tables in my module file: mymodule.py. For example I have table T1 and T2 defined:
class T1(Base):
__tablename__ = 't1'
id = Column(Integer, primary_key = True)
name = Column(String(15))
class T2(Base):
__tablename__ = 't2'
id = Column(Integer, primary_key = True)
fid = Column(Integer, ForeignKey('t1.id', onupdate='CASCADE', ondelete='CASCADE'), nullable = False)
name = Column(String(15))

After running 'alembic revision --autogenerate', in table 't2' migration code, I can just see something like that:
sa.ForeignKeyConstraint(['fid'], ['t1.id'],) without clause "onupdate='CASCADE', ondelete='CASCADE'" anymore.
So I manually added "onupdate='CASCADE', ondelete='CASCADE'", but I have more than 100 tables. Did I miss something in my module file mymodule.py?

Thank you very much!

Michael Bayer

unread,
Dec 5, 2012, 3:37:54 PM12/5/12
to sqlal...@googlegroups.com
this is ticket #92 from the other day for propagation of the ondelete, onupdate, initially, and deferred arguments of FKconstraint, just resolved in rfd50c9605e43.


Eric Ongerth

unread,
Dec 5, 2012, 7:13:33 PM12/5/12
to sqlal...@googlegroups.com
Thank you very much for that resolution!  I use these a lot.
Reply all
Reply to author
Forward
0 new messages