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]
Reviewed: https:/ /review. openstack. org/623564 /git.openstack. org/cgit/ openstack/ sqlalchemy- migrate/ commit/ ?id=231a4d2ae9f 8496cfc8eea2e6b b8186a0dd602f9
Committed: https:/
Submitter: Zuul
Branch: master
commit 231a4d2ae9f8496 cfc8eea2e6bb818 6a0dd602f9
Author: Corey Bryant <email address hidden>
Date: Fri Dec 7 13:49:20 2018 -0500
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/ae9638e9c0 ad0c36
Thanks to "László Böszörményi (GCS)" <email address hidden> for
providing the code for this patch, which has since been
slightly modified.
Change-Id: I539988ab2ad6df 6c8f423ecec1536 4ad8fcc7267
Closes-Bug: 1807262