Skip to content
This repository was archived by the owner on Sep 26, 2019. It is now read-only.

Commit c670d1d

Browse files
delijatiemonty
authored andcommitted
added bugfixes for 0.8
1 parent a71799e commit c670d1d

File tree

5 files changed

+27
-19
lines changed

5 files changed

+27
-19
lines changed

README renamed to README.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
sqlalchemy-migrate
2+
==================
3+
4+
Fork from http://code.google.com/p/sqlalchemy-migrate/ to get it working with
5+
SQLAlchemy 0.8.
6+
17
Inspired by Ruby on Rails' migrations, Migrate provides a way to deal with
28
database schema changes in `SQLAlchemy <http://sqlalchemy.org>`_ projects.
39

@@ -6,7 +12,7 @@ database change repository mechanism which can be used from the command line as
612
well as from inside python code.
713

814
Help
9-
------
15+
----
1016

1117
Sphinx documentation is available at the project page `packages.python.org
1218
<http://packages.python.org/sqlalchemy-migrate/>`_.
@@ -27,7 +33,7 @@ You can also clone a current `development version
2733
<http://github.com/stackforge/sqlalchmey-migrate>`_
2834

2935
Tests and Bugs
30-
------------------
36+
--------------
3137

3238
To run automated tests:
3339

migrate/changeset/ansisql.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
Index)
1818

1919
from migrate import exceptions
20+
import sqlalchemy.sql.compiler
2021
from migrate.changeset import constraint
2122

2223
from sqlalchemy.schema import AddConstraint, DropConstraint
@@ -153,6 +154,19 @@ class ANSISchemaChanger(AlterTableVisitor, SchemaGenerator):
153154
name. NONE means the name is unchanged.
154155
"""
155156

157+
def _index_identifier(self, ident):
158+
"""This function is move in 0.8 to _prepared_index_name"""
159+
if isinstance(ident, sqlalchemy.sql.compiler.sql._truncated_label):
160+
max = self.dialect.max_index_name_length or \
161+
self.dialect.max_identifier_length
162+
if len(ident) > max:
163+
ident = ident[0:max - 8] + \
164+
"_" + sqlalchemy.sql.compiler.util.md5_hex(ident)[-4:]
165+
else:
166+
self.dialect.validate_identifier(ident)
167+
168+
return ident
169+
156170
def visit_table(self, table):
157171
"""Rename a table. Other ops aren't supported."""
158172
self.start_alter_table(table)

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = sqlalchemy-migrate
33
summary = Database schema migration for SQLAlchemy
44
description-file =
5-
README
5+
README.rst
66
author = OpenStack
77
author-email = openstack-dev@lists.openstack.org
88
home-page = http://www.openstack.org/

test_db.cfg

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@
88
# The string '__tmp__' is substituted for a temporary file in each connection
99
# string. This is useful for sqlite tests.
1010
sqlite:///__tmp__
11-
#postgresql://scott:tiger@localhost/test_migrate
12-
#mysql://scott:tiger@localhost/test_migrate
11+
#postgresql://postgres@localhost/testdb
12+
#mysql://root@localhost/testdb
13+
#oracle://scott:tiger@localhost
14+
#firebird://scott:tiger@localhost//var/lib/firebird/databases/test_migrate

test_db.cfg.tmpl

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)