Commit a9b04eaa authored by Thomas Goirand's avatar Thomas Goirand

Removed use-legacy-alter-sqlite.patch applied upstream.

parent 835a5eaf
......@@ -6,6 +6,7 @@ migrate (0.12.0-1) experimental; urgency=medium
[ Thomas Goirand ]
* New upstream release.
* Removed Python 2 support.
* Removed use-legacy-alter-sqlite.patch applied upstream.
-- Thomas Goirand <zigo@debian.org> Tue, 26 Mar 2019 16:10:12 +0100
......
......@@ -2,4 +2,3 @@ use-local-intersphinx.patch
keep_empty_modules.patch
disable_issuetracker.patch
remove-tempest-lib-build-depends-from-upstream.patch
use-legacy-alter-sqlite.patch
Description: Use legacy_alter_table ON in sqlite recreate_table
Author: Corey Bryant <corey.bryant@canonical.com>
Date: Fri, 7 Dec 2018 13:49:20 -0500
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/nova/+bug/1807262
Bug-Debian: https://bugs.debian.org/916046
Last-Update: 2018-12-10
--- a/migrate/changeset/databases/sqlite.py
+++ b/migrate/changeset/databases/sqlite.py
@@ -9,6 +9,7 @@
from UserDict import DictMixin
from copy import copy
import re
+import sqlite3
from sqlalchemy.databases import sqlite as sa_base
from sqlalchemy.schema import ForeignKeyConstraint
@@ -96,8 +97,15 @@
if omit_constraints is None or cons.name not in omit_constraints
])
+ tup = sqlite3.sqlite_version_info
+ if tup[0] > 3 or (tup[0] == 3 and tup[1] >= 26):
+ self.append('PRAGMA legacy_alter_table = ON')
+ self.execute()
self.append('ALTER TABLE %s RENAME TO migration_tmp' % table_name)
self.execute()
+ if tup[0] > 3 or (tup[0] == 3 and tup[1] >= 26):
+ self.append('PRAGMA legacy_alter_table = OFF')
+ self.execute()
insertion_string = self._modify_table(table, column, delta)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment