summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/databases/mysql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-10-15 00:07:06 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-10-15 00:07:06 +0000
commit7e5e985c0e17a2d300f9aa8633c3610db600f2e2 (patch)
tree553780288c3fc75697d1558187c85f09a9cb42ed /lib/sqlalchemy/databases/mysql.py
parent6b40f50b87a03172d77abf0e50f42b565f416645 (diff)
downloadsqlalchemy-7e5e985c0e17a2d300f9aa8633c3610db600f2e2.tar.gz
- ForeignKey(Constraint) supports "use_alter=True", to create/drop a foreign key
via ALTER. this allows circular foreign key relationships to be set up.
Diffstat (limited to 'lib/sqlalchemy/databases/mysql.py')
-rw-r--r--lib/sqlalchemy/databases/mysql.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/sqlalchemy/databases/mysql.py b/lib/sqlalchemy/databases/mysql.py
index 2fa7e9227..86b74c364 100644
--- a/lib/sqlalchemy/databases/mysql.py
+++ b/lib/sqlalchemy/databases/mysql.py
@@ -456,6 +456,9 @@ class MySQLSchemaDropper(ansisql.ANSISchemaDropper):
def visit_index(self, index):
self.append("\nDROP INDEX " + index.name + " ON " + index.table.name)
self.execute()
+ def drop_foreignkey(self, constraint):
+ self.append("ALTER TABLE %s DROP FOREIGN KEY %s" % (self.preparer.format_table(constraint.table), constraint.name))
+ self.execute()
class MySQLIdentifierPreparer(ansisql.ANSIIdentifierPreparer):
def __init__(self, dialect):