@@ -313,20 +313,6 @@ bool SyncJournalDb::checkConnect()
313
313
qCInfo (lcDb) << " sqlite3 version" << pragma1.stringValue (0 );
314
314
}
315
315
316
- {
317
- // Future version of the client (2.6) will have an index 'metadata_parent' which
318
- // depends on a custom sqlite function which does not exist yet in 2.5.
319
- // So make sure to remove the index if it exists, otherwise we will crash when inserting
320
- // rows in the metadata database.
321
- // This needs to be done before the synchronous mode is enabled.
322
- // The 2.6 client will anyway re-creates this index if it does not exist.
323
- SqlQuery query (_db);
324
- query.prepare (" DROP INDEX IF EXISTS metadata_parent;" );
325
- if (!query.exec ()) {
326
- return sqlFail (" updateMetadataTableStructure: remove index metadata_parent" , query);
327
- }
328
- }
329
-
330
316
// Set locking mode to avoid issues with WAL on Windows
331
317
static QByteArray locking_mode_env = qgetenv (" OWNCLOUD_SQLITE_LOCKING_MODE" );
332
318
if (locking_mode_env.isEmpty ())
@@ -366,6 +352,19 @@ bool SyncJournalDb::checkConnect()
366
352
return sqlFail (" Set PRAGMA case_sensitivity" , pragma1);
367
353
}
368
354
355
+ {
356
+ // Future version of the client (2.6) will have an index 'metadata_parent' which
357
+ // depends on a custom sqlite function which does not exist yet in 2.5.
358
+ // So make sure to remove the index if it exists, otherwise we will crash when inserting
359
+ // rows in the metadata database.
360
+ // The 2.6 client will anyway re-creates this index if it does not exist.
361
+ SqlQuery query (_db);
362
+ query.prepare (" DROP INDEX IF EXISTS metadata_parent;" );
363
+ if (!query.exec ()) {
364
+ return sqlFail (" updateMetadataTableStructure: remove index metadata_parent" , query);
365
+ }
366
+ }
367
+
369
368
/* Because insert is so slow, we do everything in a transaction, and only need one call to commit */
370
369
startTransaction ();
371
370
0 commit comments