31 Commits

Author SHA1 Message Date
Zuul
f0664995a1 Merge "Import MutableMapping from the correct Python module" 2019-01-21 22:17:29 +00:00
Corey Bryant
231a4d2ae9 Use legacy_alter_table ON in sqlite recreate_table
Use "PRAGMA legacy_alter_table = ON" with sqlite >= 3.26 when
using "ALTER TABLE RENAME TO migration_tmp" to maintain legacy
behavior.

As of sqlite version 3.26, when a table is renamed using
"ALTER TABLE RENAME TO", REFERENCES clauses that refer to the
table will be updated. To maintain legacy (3.24 and earlier)
behavior, "PRAGMA legacy_alter_table" can be set to true and
"PRAGMA foreign_keys" can be set to false. [1]

[1] https://www.sqlite.org/src/info/ae9638e9c0ad0c36

Thanks to "László Böszörményi (GCS)" <gcs@debian.org> for
providing the code for this patch, which has since been
slightly modified.

Change-Id: I539988ab2ad6df6c8f423ecec15364ad8fcc7267
Closes-Bug: 1807262
2019-01-15 22:01:26 +00:00
Chih-Hsuan Yen
a00dab7bcf Import MutableMapping from the correct Python module
Change-Id: Ifb66fe22bc607b13f5c4756d3b93f5e8206c33e3
2019-01-15 18:16:06 +00:00
Matt Riedemann
ae64d828df allow dropping fkeys with sqlite
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
2015-02-20 10:04:35 -08:00
Jenkins
089663761c Merge "Move patch from oslo to drop unique constraints with sqlite" 2014-05-05 15:15:03 +00:00
Matt Riedemann
93efb62fd1 Move patch from oslo to drop unique constraints with sqlite
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
2014-04-15 19:22:03 -07: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
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
Jan Dittberner
a48190c006 merge e5bd2821eea8 from https://code.google.com/r/alyazdi-patches/
(fixes issue 125)
2011-10-28 12:25:22 +02:00
Jan Dittberner
3619347441 drop SQLAlchemy < 0.6 compatibility code 2011-10-28 10:59:10 +02:00
al.yazdi@gmail.com
cef7676b58 Fix for issue #125, create the table on the same connection as the ALTER and INSERT happen 2011-10-26 06:32:59 +00:00
Chris Withers
b5a02cb7cf remove the alter_metadata feature 2011-02-10 16:49:20 +00:00
Chris Withers
500cb6f5df fix sqlite column dropper now that the table is only modified after the visitor is run 2011-02-10 15:17:28 +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
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
iElectric
653e723ce1 move all exception classes to migrate.exceptions 2010-09-07 02:25:29 +02:00
iElectric
8b0072b3e8 move to unittest2, update README for testing instructions 2010-06-20 15:29:16 +02:00
iElectric
de3c53989d add support for SA 0.6 by Michael Bayer 2009-06-29 10:18:03 +00:00
iElectric
75e93aa410 add not supported exceptions for sqlite constraints 2009-06-27 14:33:40 +00:00
iElectric
9f7ab96881 - completely refactored ColumnDelta to extract differences between columns/parameters (also fixes issue #23)
- fixed some bugs (passing server_default) on column.alter
- updated tests, specially ColumnDelta and column.alter
- introduced alter_metadata which can preserve altering existing objects if False (defaults to True)
- updated documentation
2009-06-27 14:13:27 +00:00
iElectric
cde0f9b52d updated changeset tests. whole package is finally PEP8. fixed mysql tests&bugs. updated docs where apropriate. changeset test coverage almost at 100% 2009-06-20 22:33:03 +00:00
iElectric
7eafe744c2 - refactor migrate.changeset;
- visitors are refactored to be more unified
- constraint module is refactored, CheckConstraint is added
- documentation is partialy updated, dialect support table is added (unfinished)
- test_constraint was updated
NOTE: oracle and mysql were not tested, *may be broken*
2009-06-16 15:17:33 +00:00
iElectric
8a8b1d2366 use sqlalchemy preparer to do SQL quote formatting. this is a raw change, tests are yet to be written 2009-06-11 22:27:38 +00:00
jan.dittberner
5ecec7c680 mark ALTER TABLE ADD FOREIGN KEY as unsupported by SQLite
update corresponding test case
2009-02-18 20:08:37 +00:00
jan.dittberner
60409d80cd revert stupid test case breaking change 2009-01-25 13:40:55 +00:00
jan.dittberner
eb00570991 make migrate.changeset.databases PEP-8 clean and add it to the API docs 2009-01-25 12:52:33 +00:00
jan.dittberner
05819a6f70 apply patch for Issue #43 (better SQLite support) by Florian Apolloner 2008-12-30 20:43:40 +00:00
percious17
9f0bd657f4 most of the tests are now working with nose. 2008-12-02 05:11:36 +00:00
jan.dittberner
32aeb8e95e integrated patch by Christian Simms posted at http://groups.google.com/group/migrate-users/browse_thread/thread/952a2185baf70c4d
fix all test cases for sqlalchemy>=0.4 and still works with sqlalchemy>=0.3.10
fixes #9
2008-02-14 19:10:47 +00:00
jan.dittberner
2cfe1fc31c moved trunk, branches and tags to project root
fixes Issue #5
2008-02-06 18:39:07 +00:00