30 Commits

Author SHA1 Message Date
Jenkins
9a7a37fba4 Merge "Fix spelling mistake" 2017-03-24 21:23:38 +00:00
dineshbhor
09ec8f7816 Fix spelling mistake
TrivialFix

Change-Id: I089d9e8b57895d9878bf82d2fac397722fccc083
2016-10-26 19:57:24 +05:30
Mike Bayer
e9175a37ce Set autoincrement to False when modifying to non-Integer datatype
Starting in SQLAlchemy 1.1, the rules for when "autoincrement=True"
may be set on a column are more strict.  The migrate tests are
testing the alteration of a column from Integer to String
and then regenerating; this means we need to set autoincrement
to False as well.   A related issue in SQLAlchemy 1.1 is
also being fixed (see https://bitbucket.org/zzzeek/sqlalchemy/issues/3835/),
however this fix is not needed in order for the tests to pass here.

Change-Id: Ibd3a75fff13312411df87e17b6e5764865d69728
2016-10-20 17:47:19 -04:00
Cyril Roelandt
a03b141a95 Port to Python3
Brief summary of the modifications:

* Use six for compatibility with both Python 2 and 3;
* Replace UserDict.DictMixin with collections.MutableMapping;
* Fix relative imports;
* Use test-requirements.txt for requirements that are common to both Python 2
  and 3, and test-requirements-py{2,3}.txt for version-specific requirements;
* Miscellaneous fixes.
* Use a specific test_db_py3.cfg file for Python 3, that only runs tests on
  sqlite.

Thanks to Victor Stinner who co-wrote this patch.

Change-Id: Ia6dc536c39d274924c21fd5bb619e8e5721e04c4
Co-Authored-By: Victor Stinner <victor.stinner@enovance.com>
2014-04-09 17:32:52 +02:00
Cyril Roelandt
07909159ae tests: Replace "self.assert_" by "self.assertTrue"
The assert_() method is deprecated and can be safely replaced by assertTrue().
This patch makes sure that running the tests does not fill the screen with
warnings.

Change-Id: I8966b7f7a44f1573a4d2c398717bfc68ae40b197
2014-03-31 15:08:29 +02:00
David Ripton
d6fbf12989 Eradicate trailing whitespace
Remove all trailing spaces and tabs in every file in the project.
People have editors configured to do this, which causes them to
accidentally make little whitespace changes in unrelated commits,
which makes those commits harder to review.  Better to fix them all
at once.

Change-Id: I17d89f55f41d8599e0ab1a31f646cd161289703e
2014-02-26 15:04:54 -05:00
Matt Riedemann
85317aead6 Add DB2 10.5 Support
This patch adds the initial support for DB2 10.5 to migrate. It
includes:

1. The dialect implementation for DB2.
2. The dialect registration with the visitor.
3. Code to parse the engine name in version.py.
4. A new dependency on ibm_db_sa in test-requirements.txt.
5. A connection string in test_db.cfg for ibm_db_sa.

Part of blueprint add-db2-support

Co-authored-by: Sheng Bo Hou <sbhou@cn.ibm.com>
Co-authored-by: Thuy Christenson <thuy@us.ibm.com>
Co-authored-by: Rahul Priyadarshi <rahul.priyadarshi@in.ibm.com>
Change-Id: I745ec615487b1b06c5d1a09ea316f376d66ee4c0
2014-02-17 07:17:31 -08:00
Roman Podolyaka
2485118c24 Fix dropping of indexed columns in sqlite/sa08
Version 0.8 of SQLAlchemy added support of indexes
on expressions in addition to plain table columns,
which changed the way indexes are created.

This broke support of dropping columns of composite
indexes for SQLite: due to limitations of ALTER in
SQLite every time a column is dropped, we recreate
the whole table without the given column; if a
column is a part of a composite index, we change the
index definition to omit that column and then indexes
are recreated too.

SQLAlchemy versions starting from 0.8 no more pay
attention to 'columns' attribute of Index instances
when generating DDL for indexes, so when one of columns
of a composite index is dropped, we try to create a
new index on the column that doesn't exist anymore,
which of course fails.

Closes-Bug: #1241038

Change-Id: I777b8ce36e36f49bfb0889908811a063cf1a527b
2013-10-18 16:09:16 +03:00
Roman Podolyaka
a91766a1ac Run tests on PostgreSQL and MySQL too
In addition to running tests with different Python and SQLAlchemy
versions, they should also be run on different DB backends, which
are used in production (PostgreSQL and MySQL).

This patch:
  - modifies test_db.cfg to run tests on PostgreSQL and MySQL
    (Jenkins Slave credentials are used here, to ensure these
    tests are always run by Jenkins gate); if a backend is not
    available, test cases will be skipped for it
  - concurrency is set to 1 (sharing of the one MySQL or PostgreSQL
    DB among different test runner processes would lead to
    race conditions)
  - fixes tests dropping FK columns in MySQL: in earlier MySQL
    versions dropping a column that is a part of a FK constraint
    would lead to dropping of the FK too. As of MySQL 5.5 that's
    not the case anymore: if one tries to drop such column, he/she
    will get a very obscure error (something like "Error on rename
    of './openstack_citest/#sql-4af_aa2' to './openstack_citest/tmp_adddropcol'
    (errno: 150)") '\nALTER TABLE tmp_adddropcol DROP COLUMN r2').
    So the solution if to drop FK constraints first, and only then
    the columns it is made up of

Change-Id: I8c5d2874c83e7df46da69969ed54d85437c849e7
2013-10-12 07:04:33 +00:00
Pádraig Brady
74ccf7a397 Fix exceptions for SQLAlchemy 0.8
Change-Id: Ib541ac9d6b397300e34ca8b65aad459b612858c3
2013-07-11 22:01:32 -04:00
Monty Taylor
a71799ea2c Updated to OpenStack Build stuff. 2013-07-11 16:54:46 -04:00
Jan Dittberner
3619347441 drop SQLAlchemy < 0.6 compatibility code 2011-10-28 10:59:10 +02:00
markbmc@gmail.com
6ecf665f14 fix issue 128: "table rename failure with sqlalchemy 0.7.x" 2011-10-28 09:34:08 +02:00
Jan Dittberner
ca5d59910a fix column.create() properly 2011-05-27 21:59:35 +02:00
Jan Dittberner
1af477e661 fix unit test for adding new columns with foreign keys 2011-05-26 21:43:27 +02:00
Jan Dittberner
24031b7e82 fix one more test (addresses #112) 2011-05-25 16:06:42 +02:00
Chris Withers
0645c2fc9a Bring back alter_metadata on ColumnDelta: it seems intertwined with a lot of the tests.
So, it's a private API now...
2011-02-11 10:27:39 +00:00
Chris Withers
b5a02cb7cf remove the alter_metadata feature 2011-02-10 16:49:20 +00:00
Chris Withers
b1745bee52 firebird can only drop named foreign keys 2011-02-10 15:16:35 +00:00
Chris Withers
f749919240 These drop indexes appear to only be for firebird.
Once firebird is fixed, they're not needed.
2011-02-10 15:16:15 +00:00
chrisw
adf4113a0b Fix issue 94 - it was impossible to add a column with a non-unique index.
Also implement more functionality with unique and foreign key constrains for sqlite.
2010-09-09 15:38:42 +01:00
chrisw
a085ffa590 implement column adding with foreign keys on sqlite 2010-09-09 13:58:41 +01:00
chrisw
a7c0c18a52 Fix bug with column dropping involving foreign keys.
Bonus: remove_from_table now understands foreign keys
2010-09-09 11:53:08 +01:00
chrisw
5cf42fbf76 fix for issue 96: deleting a column in sqlite shouldn't delete all indexes
bonus: remove_from_table now removes indexes
2010-09-09 09:15:28 +01:00
chrisw
802658018d dammit! 2010-09-08 16:21:54 +01:00
chrisw
10a16f5251 hopefully fix test failures 2010-09-08 14:35:01 +01:00
chrisw
ac848a295a hopefully make py2.4 compatible 2010-09-07 19:19:32 +01:00
chrisw
cade5fb261 - capture deprecation warnings and assert they re as they should be
- re-word alter_column deprecation warning to make more sense
2010-09-07 19:04:12 +01:00
iElectric
653e723ce1 move all exception classes to migrate.exceptions 2010-09-07 02:25:29 +02:00
Bob Farrell
fd8d313683 move tests/ directory into migrate/tests (much better form) and fix all import lines and other minor issues 2010-06-10 18:08:06 +01:00