summaryrefslogtreecommitdiff
path: root/migrate/changeset/databases/mysql.py
diff options
context:
space:
mode:
authorJan Dittberner <jan.dittberner@googlemail.com>2011-10-28 10:59:10 +0200
committerJan Dittberner <jan.dittberner@googlemail.com>2011-10-28 10:59:10 +0200
commit3619347441ac129bfa2a266714b9fe933bbb4942 (patch)
treeeb805693a593d5e8550cae900375c13d78c71d2f /migrate/changeset/databases/mysql.py
parente4ad6e357f62f9fe333042e9190285ad6f283ad1 (diff)
downloadsqlalchemy-migrate-3619347441ac129bfa2a266714b9fe933bbb4942.tar.gz
drop SQLAlchemy < 0.6 compatibility code
Diffstat (limited to 'migrate/changeset/databases/mysql.py')
-rw-r--r--migrate/changeset/databases/mysql.py43
1 files changed, 7 insertions, 36 deletions
diff --git a/migrate/changeset/databases/mysql.py b/migrate/changeset/databases/mysql.py
index badd9fe..6987b4b 100644
--- a/migrate/changeset/databases/mysql.py
+++ b/migrate/changeset/databases/mysql.py
@@ -6,13 +6,10 @@ from sqlalchemy.databases import mysql as sa_base
from sqlalchemy import types as sqltypes
from migrate import exceptions
-from migrate.changeset import ansisql, SQLA_06
+from migrate.changeset import ansisql
-if not SQLA_06:
- MySQLSchemaGenerator = sa_base.MySQLSchemaGenerator
-else:
- MySQLSchemaGenerator = sa_base.MySQLDDLCompiler
+MySQLSchemaGenerator = sa_base.MySQLDDLCompiler
class MySQLColumnGenerator(MySQLSchemaGenerator, ansisql.ANSIColumnGenerator):
pass
@@ -53,37 +50,11 @@ class MySQLSchemaChanger(MySQLSchemaGenerator, ansisql.ANSISchemaChanger):
class MySQLConstraintGenerator(ansisql.ANSIConstraintGenerator):
pass
-if SQLA_06:
- class MySQLConstraintDropper(MySQLSchemaGenerator, ansisql.ANSIConstraintDropper):
- def visit_migrate_check_constraint(self, *p, **k):
- raise exceptions.NotSupportedError("MySQL does not support CHECK"
- " constraints, use triggers instead.")
-
-else:
- class MySQLConstraintDropper(ansisql.ANSIConstraintDropper):
-
- def visit_migrate_primary_key_constraint(self, constraint):
- self.start_alter_table(constraint)
- self.append("DROP PRIMARY KEY")
- self.execute()
-
- def visit_migrate_foreign_key_constraint(self, constraint):
- self.start_alter_table(constraint)
- self.append("DROP FOREIGN KEY ")
- constraint.name = self.get_constraint_name(constraint)
- self.append(self.preparer.format_constraint(constraint))
- self.execute()
-
- def visit_migrate_check_constraint(self, *p, **k):
- raise exceptions.NotSupportedError("MySQL does not support CHECK"
- " constraints, use triggers instead.")
-
- def visit_migrate_unique_constraint(self, constraint, *p, **k):
- self.start_alter_table(constraint)
- self.append('DROP INDEX ')
- constraint.name = self.get_constraint_name(constraint)
- self.append(self.preparer.format_constraint(constraint))
- self.execute()
+
+class MySQLConstraintDropper(MySQLSchemaGenerator, ansisql.ANSIConstraintDropper):
+ def visit_migrate_check_constraint(self, *p, **k):
+ raise exceptions.NotSupportedError("MySQL does not support CHECK"
+ " constraints, use triggers instead.")
class MySQLDialect(ansisql.ANSIDialect):