File tree Expand file tree Collapse file tree 2 files changed +16
-20
lines changed
packages/powersync-op-sqlite/src/db Expand file tree Collapse file tree 2 files changed +16
-20
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @powersync/op-sqlite ' : patch
3+ ---
4+
5+ Fixed an issue where the default ` op-sqlite ` database location determination logic was being overridden. The ` dbLocation ` is now only applied when explicitly provided, resolving issues with features like iOS App Groups.
Original file line number Diff line number Diff line change @@ -112,30 +112,21 @@ export class OPSQLiteDBAdapter extends BaseObserver<DBAdapterListener> implement
112112 } ) ;
113113 }
114114
115- private getDbLocation ( dbLocation ?: string ) : string {
116- if ( Platform . OS === 'ios' ) {
117- return dbLocation ?? IOS_LIBRARY_PATH ;
118- } else {
119- return dbLocation ?? ANDROID_DATABASE_PATH ;
115+ private openDatabase ( dbFilename : string , encryptionKey ?: string ) : DB {
116+ const openOptions : Parameters < typeof open > [ 0 ] = {
117+ name : dbFilename
118+ } ;
119+
120+ if ( this . options . dbLocation ) {
121+ openOptions . location = this . options . dbLocation ;
120122 }
121- }
122123
123- private openDatabase ( dbFilename : string , encryptionKey ?: string ) : DB {
124- //This is needed because an undefined/null dbLocation will cause the open function to fail
125- const location = this . getDbLocation ( this . options . dbLocation ) ;
126- //Simarlily if the encryption key is undefined/null when using SQLCipher it will cause the open function to fail
124+ // If the encryption key is undefined/null when using SQLCipher it will cause the open function to fail
127125 if ( encryptionKey ) {
128- return open ( {
129- name : dbFilename ,
130- location : location ,
131- encryptionKey : encryptionKey
132- } ) ;
133- } else {
134- return open ( {
135- name : dbFilename ,
136- location : location
137- } ) ;
126+ openOptions . encryptionKey = encryptionKey ;
138127 }
128+
129+ return open ( openOptions ) ;
139130 }
140131
141132 private loadAdditionalExtensions ( DB : DB ) {
You can’t perform that action at this time.
0 commit comments