[Sqlalchemy-commits] sqlalchemy: fix this for PG, other on update cascade DBs
Brought to you by:
zzzeek
From: <co...@sq...> - 2011-10-30 19:31:16
|
details: http://hg.sqlalchemy.org/sqlalchemy/sqlalchemy/rev/9504b4c199ce changeset: 7904:9504b4c199ce user: zzzeek date: Sun Oct 30 15:31:03 2011 -0400 description: fix this for PG, other on update cascade DBs diffstat: test/orm/test_hasparent.py | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diffs (24 lines): diff -r 8fd62720392e -r 9504b4c199ce test/orm/test_hasparent.py --- a/test/orm/test_hasparent.py Sun Oct 30 15:10:56 2011 -0400 +++ b/test/orm/test_hasparent.py Sun Oct 30 15:31:03 2011 -0400 @@ -27,12 +27,19 @@ @classmethod def define_tables(cls, metadata): + if testing.against('oracle'): + fk_args = dict(deferrable=True, initially='deferred') + elif testing.against('mysql'): + fk_args = {} + else: + fk_args = dict(onupdate='cascade') + Table('users', metadata, Column('id', Integer, primary_key=True, test_needs_autoincrement=True), ) Table('addresses', metadata, Column('id', Integer, primary_key=True, test_needs_autoincrement=True), - Column('user_id', Integer, ForeignKey('users.id')), + Column('user_id', Integer, ForeignKey('users.id', **fk_args)), ) @classmethod |