@@ -12,7 +12,7 @@ use crate::error::{PSResult, SQLiteError};
12
12
use crate :: fix035:: apply_v035_fix;
13
13
use crate :: sync:: bucket_priority:: BucketPriority ;
14
14
15
- pub const LATEST_VERSION : i32 = 9 ;
15
+ pub const LATEST_VERSION : i32 = 10 ;
16
16
17
17
pub fn powersync_migrate (
18
18
ctx : * mut sqlite:: context ,
@@ -370,5 +370,22 @@ json_object('sql', 'DELETE FROM ps_migration WHERE id >= 9')
370
370
local_db. exec_safe ( stmt) . into_db_result ( local_db) ?;
371
371
}
372
372
373
+ if current_version < 10 && target_version >= 10 {
374
+ let stmt = "\
375
+ PRAGMA writable_schema = ON;
376
+ UPDATE sqlite_schema SET sql = replace(sql, 'data TEXT', 'data ANY') WHERE name = 'ps_oplog';
377
+ PRAGMA writable_schema = RESET;
378
+
379
+ INSERT INTO ps_migration(id, down_migrations) VALUES(10, json_array(
380
+ json_object('sql', 'PRAGMA writable_schema = ON'),
381
+ json_object('sql', 'UPDATE sqlite_schema SET sql = replace(sql, ''data ANY'', ''data TEXT'') WHERE name = ''ps_oplog'''),
382
+ json_object('sql', 'PRAGMA writable_schema = RESET'),
383
+ json_object('sql', 'DELETE FROM ps_migration WHERE id >= 10')
384
+ ));
385
+ " ;
386
+
387
+ local_db. exec_safe ( stmt) . into_db_result ( local_db) ?;
388
+ }
389
+
373
390
Ok ( ( ) )
374
391
}
0 commit comments