##// END OF EJS Templates
migrations: fixed db migrate for latest sqlite version.
marcink -
r4342:cf6cf2b9 default
parent child
Show More
@@ -12,7 +12,7 from sqlalchemy.schema import UniqueCons
12
12
13 from rhodecode.lib.dbmigrate.migrate import exceptions
13 from rhodecode.lib.dbmigrate.migrate import exceptions
14 from rhodecode.lib.dbmigrate.migrate.changeset import ansisql
14 from rhodecode.lib.dbmigrate.migrate.changeset import ansisql
15
15 import sqlite3
16
16
17 SQLiteSchemaGenerator = sa_base.SQLiteDDLCompiler
17 SQLiteSchemaGenerator = sa_base.SQLiteDDLCompiler
18
18
@@ -73,10 +73,16 class SQLiteHelper(SQLiteCommon):
73 cons for cons in table.constraints
73 cons for cons in table.constraints
74 if omit_uniques is None or cons.name not in omit_uniques
74 if omit_uniques is None or cons.name not in omit_uniques
75 ])
75 ])
76 tup = sqlite3.sqlite_version_info
77 if tup[0] > 3 or (tup[0] == 3 and tup[1] >= 26):
78 self.append('PRAGMA legacy_alter_table = ON')
79 self.execute()
76
80
77 self.append('ALTER TABLE %s RENAME TO migration_tmp' % table_name)
81 self.append('ALTER TABLE %s RENAME TO migration_tmp' % table_name)
78 self.execute()
82 self.execute()
79
83 if tup[0] > 3 or (tup[0] == 3 and tup[1] >= 26):
84 self.append('PRAGMA legacy_alter_table = OFF')
85 self.execute()
80 insertion_string = self._modify_table(table, column, delta)
86 insertion_string = self._modify_table(table, column, delta)
81
87
82 table.create(bind=self.connection)
88 table.create(bind=self.connection)
General Comments 0
You need to be logged in to leave comments. Login now