summaryrefslogtreecommitdiff
path: root/migrate/tests
Commit message (Collapse)AuthorAgeFilesLines
* Retire github mirror, repo moved to opendevHEADmasterJim Rollenhagen2019-09-2631-4252/+0
|
* Merge "Fix spelling mistake"Jenkins2017-03-242-3/+3
|\
| * Fix spelling mistakedineshbhor2016-10-262-3/+3
| | | | | | | | | | | | TrivialFix Change-Id: I089d9e8b57895d9878bf82d2fac397722fccc083
* | Set autoincrement to False when modifying to non-Integer datatypeMike Bayer2016-10-201-0/+13
|/ | | | | | | | | | | | 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
* Raise VersionNotFoundError instead of KeyErrordineshbhor2016-05-271-0/+4
| | | | | | | | | | | | | | Currently migrate.versioning.api.upgrade() raises KeyError instead of sqlalchemy-migrate specific exception if migration script file is not present in migration repository. Raised migrate.exception.VersionNotFoundError if the specified migration script does not exist in the repository. Made VersionNotFoundError exception class as a subclass of KeyError in order to avoid breaking existing users looking for KeyError. Related-Bug: #1546441 Change-Id: I0210d56a6e85f03c44cea027f50863faaf050c1d
* Add VerNum.__index__() for Python 3 supportVictor Stinner2015-07-281-0/+7
| | | | | | | | | | On Python 3, some functions like range() don't try to call the __int__() method to cast an object to integer, but try instead the __index__() method. Add an __index__() method to mimick correctly the int type on Python 3. Change-Id: I8df116d80e201778714a59367600eaef644266ed
* Update tests and reqs for SQLA 1.0Mike Bayer2015-07-012-3/+6
| | | | | | | Lift the requirements to support SQLAlchemy 1.0. Two tests were calling upon revised APIs and required adjustment. Change-Id: Ic91a91bb3c915027b522eace302f2ed074233294
* Ignore stderr output when invoking migrate script in testsMike Bayer2015-07-011-15/+34
| | | | | | | | | | Under Python 2.6 a setuptools warning is produced when the migrate runner runs. Since migrate invokes its own commandline client from tests in a separate shell, the fixture we're using to do that must be told not to complain about this stderr. Change-Id: Ib5823754d6ffabe954665f2a7529ed0e56591ebf
* Merge "Don't run the test if _setup() fails"0.9.5Jenkins2015-02-241-12/+2
|\
| * Don't run the test if _setup() failsRoman Podoliaka2015-02-231-12/+2
| | | | | | | | Change-Id: I2c89c98961044f0e0a1d9b4c2eeea190c5830eed
* | Merge "script: strip comments in SQL statements"Jenkins2015-02-241-0/+10
|\ \ | |/ |/|
| * script: strip comments in SQL statementsIhar Hrachyshka2015-01-141-0/+10
| | | | | | | | | | | | | | | | | | Regular expression does not match correctly against statements that contain comments at their start. So strip those comments first (and whitespaces, while we are at it). Change-Id: Iad9b544bf995374d76cab1e125658aae2f8511f4 Closes-Bug: #1410494
* | allow dropping fkeys with sqliteMatt Riedemann2015-02-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This implements the ability to drop foreign keys with sqlite. It's basically the same implementation used for dropping unique constraints so the common code is refactored. The existing FKey test that was skipping sqlite is no longer skipped to show this works. Change-Id: Idaaf4229e34af4c21c3bcead4b4e22491d24238e Closes-Bug: #1423955
* | Merge "Replace assertNotEquals with assertNotEqual."Jenkins2015-01-153-3/+3
|\ \ | |/ |/|
| * Replace assertNotEquals with assertNotEqual.Cyril Roelandt2014-10-303-3/+3
| | | | | | | | | | | | The former is deprecated and the latter should be used. Change-Id: I9d6dca41cb737062e6d4467c24dbc88901ab9a14
* | Ignore transaction management statements in SQL scriptsIhar Hrachyshka2015-01-091-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that we don't run SQL script with a single .execute() call, transaction management statements (BEGIN, COMMIT, END) fail with operational error. Ignore them if occurred in a script. All in all, transactions are managed by SQLAlchemy-migrate itself, so there is no reason for the calling code to pass those statements in a SQL script. Warn user about the statements that are ignored. The ideal response to such a warning from library users is removing those redundant transaction management statements from their scripts. Note: ROLLBACK is not ignored even though it's one of transaction management statements because its usage in migration scripts is insane anyway, and we're better fail on it and not (almost) silently ignore it. Change-Id: Ie4179c0e9341d42656d66821aaac23f8dcd33927 Closes-bug: 1368391
* | Don't add warnings filter on importBrant Knudson2015-01-081-1/+0
|/ | | | | | | | | The changeset module was adding a warnings filter on import. This affects all applications that wind up importing it. A library shouldn't modify the warnings filters unless asked. Closes-Bug: #1407736 Change-Id: I893f8be48efd3d3642e977ab587c9e6dc867258b
* SqlScript: execute multiple statements one by one0.9.2Ihar Hrachyshka2014-08-231-1/+1
| | | | | | | | | | | | | | | | | Some drivers [f.e. MySQL Connector] do not like multiple statements being passed to .execute(). They require either passing multi=True parameter to .execute() that is not DB-API 2.0 defined, or executing those statements one by one. For that patch, I've chosen the second option to stay away from driver specific hacks. Also removed SQLite hack that seems to be related to the same multiple statements issue. blueprint enable-mysql-connector Change-Id: Ic6d53ed1fef8aee9471f3540f06b39cd5ee4ef82
* Merge "Fix 3 files with Windows line endings to Unix line endings."Jenkins2014-07-221-90/+88
|\
| * Fix 3 files with Windows line endings to Unix line endings.David Ripton2014-02-271-90/+88
| | | | | | | | Change-Id: Iadc8e5d195bf998a117da4b7102a8955e238dd4e
* | Merge "Move patch from oslo to drop unique constraints with sqlite"0.9.1Jenkins2014-05-051-1/+1
|\ \
| * | Move patch from oslo to drop unique constraints with sqliteMatt Riedemann2014-04-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | oslo-incubator commit 3f503faac for making sqlite work with dropping unique constraints in database migrations. This was made in oslo-incubator since at the time sqlalchemy-migrate was not in stackforge. Now that we can update sqlalchemy-migrate, move the patch over from oslo. This change also adds the support for the case that a unique constraint is dropped because the column it's on is dropped. Note that there are already unit tests that cover dropping a unique constraint directly and implicitly via dropping a column that is in the unique constraint. Related-Bug: #1307266 Change-Id: I5ee8082a83aebf66f6e1dacb093ed79e13f73f5e
* | | Port to Python3Cyril Roelandt2014-04-0911-41/+56
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | tests: Replace "self.assert_" by "self.assertTrue"Cyril Roelandt2014-03-3113-108/+108
| | | | | | | | | | | | | | | | 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
* | Merge "Eradicate trailing whitespace"Jenkins2014-03-2914-85/+85
|\ \
| * | Eradicate trailing whitespaceDavid Ripton2014-02-2614-85/+85
| |/ | | | | | | | | | | | | | | | | | | 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
* | fix scripttest compatThomas Goirand2014-03-051-1/+0
|/ | | | | | | | There's no script_path param in the current version of scripttest. This patch fixes that by removing the param, which by the way isn't useful. Change-Id: Ic78cea25bb472702473e98b48a8ff74c01545aa3
* Add DB2 10.5 SupportMatt Riedemann2014-02-176-13/+65
| | | | | | | | | | | | | | | | | | 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
* Fix dropping of indexed columns in sqlite/sa08Roman Podolyaka2013-10-181-1/+34
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Run tests on PostgreSQL and MySQL tooRoman Podolyaka2013-10-122-10/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix exceptions for SQLAlchemy 0.8Pádraig Brady2013-07-111-2/+2
| | | | Change-Id: Ib541ac9d6b397300e34ca8b65aad459b612858c3
* Updated to OpenStack Build stuff.Monty Taylor2013-07-1115-162/+152
|
* fix error, Text columns have no widthJan Dittberner2013-02-091-1/+1
|
* fix deprecation warning by using MetaData.reflectJan Dittberner2013-02-093-5/+9
|
* apply patch for issue #72 by asuffield@gmail.comasuffield@gmail.com2012-01-231-0/+10
| | | fixes #72
* Fix excludeTablesgetDiffOfModelAgainstModel is not passingJason Michalski2011-12-171-7/+23
| | | | | excludeTables correctly Fixes issue 140
* add regression test (fixes issue 105)Jan Dittberner2011-10-281-0/+6
|
* fix issues with ConfigParser and existing repositories (fixes issue 115)Jan Dittberner2011-10-281-1/+1
|
* drop SQLAlchemy < 0.6 compatibility codeJan Dittberner2011-10-285-39/+17
|
* fix issue 128: "table rename failure with sqlalchemy 0.7.x"markbmc@gmail.com2011-10-281-1/+9
|
* Use two models in generated migrations. Test column addition and removal.Gabriel2011-07-072-18/+47
|
* Output has changed even without the SQLa patch, update #122 tests.Gabriel2011-07-051-1/+1
|
* Fix and test issue 118. Clarify genmodel transformations.Gabriel2011-07-052-39/+76
|
* Fix some tests that broke when adding descriptions for sql scriptsPete Keen2011-06-124-15/+15
|
* Allow descriptions in sql change script filenamesPete Keen2011-06-101-1/+2
|
* Optionally number versions with timestamps instead of sequencesPete Keen2011-06-101-0/+19
|
* fix column.create() properlyJan Dittberner2011-05-271-2/+0
|
* add migrate.__version__ (Fixes issue 111)Jan Dittberner2011-05-271-0/+11
| | | | | - add __version__ to migrate/__init__.py - add test in migrate/tests/__init__.py - update docs/changelog.rst
* fix unit test for adding new columns with foreign keysJan Dittberner2011-05-261-1/+8
|
* SQLAlchemy 0.7's column.foreign_keys is a set and has no _list (addresses #112)Jan Dittberner2011-05-251-8/+32
|