summaryrefslogtreecommitdiff
path: root/migrate/changeset
diff options
context:
space:
mode:
authorJosip Delic <delijati@googlemail.com>2013-06-13 17:17:34 +0200
committerMonty Taylor <mordred@inaugust.com>2013-07-11 17:07:04 -0400
commitc670d1d36a742ffe6c018920359424b7ece2b516 (patch)
tree88a3a34479d75a5197edd6c2799d448096c872ca /migrate/changeset
parenta71799ea2cbfa1354c786991a85b610753f5474c (diff)
downloadsqlalchemy-migrate-c670d1d36a742ffe6c018920359424b7ece2b516.tar.gz
added bugfixes for 0.8
Diffstat (limited to 'migrate/changeset')
-rw-r--r--migrate/changeset/ansisql.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/migrate/changeset/ansisql.py b/migrate/changeset/ansisql.py
index 9ded560..79e406c 100644
--- a/migrate/changeset/ansisql.py
+++ b/migrate/changeset/ansisql.py
@@ -17,6 +17,7 @@ from sqlalchemy.schema import (ForeignKeyConstraint,
Index)
from migrate import exceptions
+import sqlalchemy.sql.compiler
from migrate.changeset import constraint
from sqlalchemy.schema import AddConstraint, DropConstraint
@@ -153,6 +154,19 @@ class ANSISchemaChanger(AlterTableVisitor, SchemaGenerator):
name. NONE means the name is unchanged.
"""
+ def _index_identifier(self, ident):
+ """This function is move in 0.8 to _prepared_index_name"""
+ if isinstance(ident, sqlalchemy.sql.compiler.sql._truncated_label):
+ max = self.dialect.max_index_name_length or \
+ self.dialect.max_identifier_length
+ if len(ident) > max:
+ ident = ident[0:max - 8] + \
+ "_" + sqlalchemy.sql.compiler.util.md5_hex(ident)[-4:]
+ else:
+ self.dialect.validate_identifier(ident)
+
+ return ident
+
def visit_table(self, table):
"""Rename a table. Other ops aren't supported."""
self.start_alter_table(table)