@@ -12,7 +12,7 @@ use crate::error::{PSResult, SQLiteError};
1212use crate :: fix035:: apply_v035_fix;
1313use crate :: sync:: bucket_priority:: BucketPriority ;
1414
15- pub const LATEST_VERSION : i32 = 9 ;
15+ pub const LATEST_VERSION : i32 = 10 ;
1616
1717pub fn powersync_migrate (
1818 ctx : * mut sqlite:: context ,
@@ -370,5 +370,22 @@ json_object('sql', 'DELETE FROM ps_migration WHERE id >= 9')
370370 local_db. exec_safe ( stmt) . into_db_result ( local_db) ?;
371371 }
372372
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+
373390 Ok ( ( ) )
374391}
0 commit comments