[entropy.db] _migrateBaseinfoExtrainfo: fix foreign_keys usage, and drop all indexes

Using pragma inside executescript() won't work and foreign_keys were
kept enabled, resulting in extrainfo table being wiped.
At the same time, dropping all the indexes before starting dramatically
improves the execution speed.
This commit is contained in:
Fabio Erculiani
2012-01-24 18:33:33 +01:00
parent 7170a1e13c
commit a7b2ff1301
+3 -2
View File
@@ -5913,9 +5913,10 @@ class EntropyRepository(EntropyRepositoryBase):
importance = 1,
level = "warning")
self.dropAllIndexes()
self._cursor().execute("pragma foreign_keys = OFF").fetchall()
self._cursor().executescript("""
BEGIN TRANSACTION;
PRAGMA foreign_keys = OFF;
DROP TABLE IF EXISTS baseinfo_new_temp;
CREATE TABLE baseinfo_new_temp (
@@ -5965,9 +5966,9 @@ class EntropyRepository(EntropyRepositoryBase):
ALTER TABLE extrainfo_new_temp RENAME TO extrainfo;
DROP TABLE flags;
PRAGMA foreign_keys = ON;
COMMIT;
""")
self._cursor().execute("pragma foreign_keys = ON").fetchall()
self._setSetting("_baseinfo_extrainfo_2010", "1")