Packages update
This commit is contained in:
@@ -4,13 +4,10 @@
|
||||
from sqlalchemy.databases import firebird as sa_base
|
||||
from sqlalchemy.schema import PrimaryKeyConstraint
|
||||
from migrate import exceptions
|
||||
from migrate.changeset import ansisql, SQLA_06
|
||||
from migrate.changeset import ansisql
|
||||
|
||||
|
||||
if SQLA_06:
|
||||
FBSchemaGenerator = sa_base.FBDDLCompiler
|
||||
else:
|
||||
FBSchemaGenerator = sa_base.FBSchemaGenerator
|
||||
FBSchemaGenerator = sa_base.FBDDLCompiler
|
||||
|
||||
class FBColumnGenerator(FBSchemaGenerator, ansisql.ANSIColumnGenerator):
|
||||
"""Firebird column generator implementation."""
|
||||
@@ -41,10 +38,7 @@ class FBColumnDropper(ansisql.ANSIColumnDropper):
|
||||
# is deleted!
|
||||
continue
|
||||
|
||||
if SQLA_06:
|
||||
should_drop = column.name in cons.columns
|
||||
else:
|
||||
should_drop = cons.contains_column(column) and cons.name
|
||||
should_drop = column.name in cons.columns
|
||||
if should_drop:
|
||||
self.start_alter_table(column)
|
||||
self.append("DROP CONSTRAINT ")
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -5,13 +5,10 @@ import sqlalchemy as sa
|
||||
from sqlalchemy.databases import oracle as sa_base
|
||||
|
||||
from migrate import exceptions
|
||||
from migrate.changeset import ansisql, SQLA_06
|
||||
from migrate.changeset import ansisql
|
||||
|
||||
|
||||
if not SQLA_06:
|
||||
OracleSchemaGenerator = sa_base.OracleSchemaGenerator
|
||||
else:
|
||||
OracleSchemaGenerator = sa_base.OracleDDLCompiler
|
||||
OracleSchemaGenerator = sa_base.OracleDDLCompiler
|
||||
|
||||
|
||||
class OracleColumnGenerator(OracleSchemaGenerator, ansisql.ANSIColumnGenerator):
|
||||
|
||||
@@ -3,14 +3,10 @@
|
||||
|
||||
.. _`PostgreSQL`: http://www.postgresql.org/
|
||||
"""
|
||||
from migrate.changeset import ansisql, SQLA_06
|
||||
from migrate.changeset import ansisql
|
||||
|
||||
if not SQLA_06:
|
||||
from sqlalchemy.databases import postgres as sa_base
|
||||
PGSchemaGenerator = sa_base.PGSchemaGenerator
|
||||
else:
|
||||
from sqlalchemy.databases import postgresql as sa_base
|
||||
PGSchemaGenerator = sa_base.PGDDLCompiler
|
||||
from sqlalchemy.databases import postgresql as sa_base
|
||||
PGSchemaGenerator = sa_base.PGDDLCompiler
|
||||
|
||||
|
||||
class PGColumnGenerator(PGSchemaGenerator, ansisql.ANSIColumnGenerator):
|
||||
|
||||
@@ -9,13 +9,11 @@ from copy import copy
|
||||
from sqlalchemy.databases import sqlite as sa_base
|
||||
|
||||
from migrate import exceptions
|
||||
from migrate.changeset import ansisql, SQLA_06
|
||||
from migrate.changeset import ansisql
|
||||
|
||||
|
||||
if not SQLA_06:
|
||||
SQLiteSchemaGenerator = sa_base.SQLiteSchemaGenerator
|
||||
else:
|
||||
SQLiteSchemaGenerator = sa_base.SQLiteDDLCompiler
|
||||
SQLiteSchemaGenerator = sa_base.SQLiteDDLCompiler
|
||||
|
||||
|
||||
class SQLiteCommon(object):
|
||||
|
||||
@@ -39,7 +37,7 @@ class SQLiteHelper(SQLiteCommon):
|
||||
|
||||
insertion_string = self._modify_table(table, column, delta)
|
||||
|
||||
table.create()
|
||||
table.create(bind=self.connection)
|
||||
self.append(insertion_string % {'table_name': table_name})
|
||||
self.execute()
|
||||
self.append('DROP TABLE migration_tmp')
|
||||
|
||||
Reference in New Issue
Block a user