From 2272f30af435c5283157724bbb16fb0a573159ce Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 21 Jun 2012 15:39:48 -0400 Subject: - [feature] Added "MATCH" clause to ForeignKey, ForeignKeyConstraint, courtesy Ryan Kelly. [ticket:2502] --- lib/sqlalchemy/sql/compiler.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/sqlalchemy/sql/compiler.py') diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index fd7e7d773..8a8c773f8 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -1726,6 +1726,7 @@ class DDLCompiler(engine.Compiled): ', '.join(preparer.quote(f.column.name, f.column.quote) for f in constraint._elements.values()) ) + text += self.define_constraint_match(constraint) text += self.define_constraint_cascades(constraint) text += self.define_constraint_deferrability(constraint) return text @@ -1765,6 +1766,12 @@ class DDLCompiler(engine.Compiled): text += " INITIALLY %s" % constraint.initially return text + def define_constraint_match(self, constraint): + text = "" + if constraint.match is not None: + text += " MATCH %s" % constraint.match + return text + class GenericTypeCompiler(engine.TypeCompiler): def visit_CHAR(self, type_): -- cgit v1.2.1