added bugfixes for 0.8

This commit is contained in:
Josip Delic 2013-06-13 17:17:34 +02:00 committed by Monty Taylor
parent a71799ea2c
commit c670d1d36a
5 changed files with 27 additions and 19 deletions

View File

@ -1,3 +1,9 @@
sqlalchemy-migrate
==================
Fork from http://code.google.com/p/sqlalchemy-migrate/ to get it working with
SQLAlchemy 0.8.
Inspired by Ruby on Rails' migrations, Migrate provides a way to deal with
database schema changes in `SQLAlchemy <http://sqlalchemy.org>`_ projects.
@ -6,7 +12,7 @@ database change repository mechanism which can be used from the command line as
well as from inside python code.
Help
------
----
Sphinx documentation is available at the project page `packages.python.org
<http://packages.python.org/sqlalchemy-migrate/>`_.
@ -27,7 +33,7 @@ You can also clone a current `development version
<http://github.com/stackforge/sqlalchmey-migrate>`_
Tests and Bugs
------------------
--------------
To run automated tests:

View File

@ -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)

View File

@ -2,7 +2,7 @@
name = sqlalchemy-migrate
summary = Database schema migration for SQLAlchemy
description-file =
README
README.rst
author = OpenStack
author-email = openstack-dev@lists.openstack.org
home-page = http://www.openstack.org/

View File

@ -8,5 +8,7 @@
# The string '__tmp__' is substituted for a temporary file in each connection
# string. This is useful for sqlite tests.
sqlite:///__tmp__
#postgresql://scott:tiger@localhost/test_migrate
#mysql://scott:tiger@localhost/test_migrate
#postgresql://postgres@localhost/testdb
#mysql://root@localhost/testdb
#oracle://scott:tiger@localhost
#firebird://scott:tiger@localhost//var/lib/firebird/databases/test_migrate

View File

@ -1,14 +0,0 @@
# test_db.cfg
#
# This file contains a list of connection strings which will be used by
# database tests. Tests will be executed once for each string in this file.
# You should be sure that the database used for the test doesn't contain any
# important data. See README for more information.
#
# The string '__tmp__' is substituted for a temporary file in each connection
# string. This is useful for sqlite tests.
sqlite:///__tmp__
postgresql://scott:tiger@localhost/test_migrate
mysql://scott:tiger@localhost/test_migrate
oracle://scott:tiger@localhost
firebird://scott:tiger@localhost//var/lib/firebird/databases/test_migrate