Comment 8 for bug 1807262

Revision history for this message
Laszlo Boszormenyi (gcs) wrote :

It's 'PRAGMA legacy_alter_table = ON' and the following change in src:migrate (0.11.0 version) might do the trick.

@@ -9,6 +9,7 @@ except ImportError: # Python 2
     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,6 +97,10 @@ class SQLiteHelper(SQLiteCommon):
             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()

@@ -106,6 +111,9 @@ class SQLiteHelper(SQLiteCommon):
         self.execute()
         self.append('DROP TABLE migration_tmp')
         self.execute()
+ if tup[0] > 3 or (tup[0] == 3 and tup[1] >= 26):
+ self.append('PRAGMA legacy_alter_table = OFF')
+ self.execute()

     def visit_column(self, delta):
         if isinstance(delta, DictMixin):