add support for ondelete and oncascade to ANSI-SQL foreign key creation

address Issue 48
This commit is contained in:
jan.dittberner 2009-02-20 18:24:44 +00:00
parent 11be1bcb20
commit d85115c611

View File

@ -290,6 +290,10 @@ class ANSIConstraintGenerator(ANSIConstraintCommon):
)
ret = "CONSTRAINT %(name)s FOREIGN KEY (%(columns)s) "\
"REFERENCES %(reftable)s (%(referenced)s)" % params
if cons.onupdate:
ret = ret + " ON UPDATE %s" % cons.onupdate
if cons.ondelete:
ret = ret + " ON DELETE %s" % cons.ondelete
elif isinstance(cons, constraint.CheckConstraint):
ret = "CHECK (%s)" % cons.sqltext
else: