Skip to content

Commit ac2839f

Browse files
committed
Minor comment and await on initialized in OPSQlite refreshSchema.
1 parent 944bc83 commit ac2839f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

packages/common/src/db/DBAdapter.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ export interface DBAdapter extends BaseObserverInterface<DBAdapterListener>, DBG
101101
readTransaction: <T>(fn: (tx: Transaction) => Promise<T>, options?: DBLockOptions) => Promise<T>;
102102
writeLock: <T>(fn: (tx: LockContext) => Promise<T>, options?: DBLockOptions) => Promise<T>;
103103
writeTransaction: <T>(fn: (tx: Transaction) => Promise<T>, options?: DBLockOptions) => Promise<T>;
104+
/**
105+
* This method refreshes the schema information across all connections. This is for advanced use cases, and should generally not be needed.
106+
*/
104107
refreshSchema: () => Promise<void>;
105108
}
106109

packages/powersync-op-sqlite/src/db/OPSqliteAdapter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ export class OPSQLiteDBAdapter extends BaseObserver<DBAdapterListener> implement
273273
}
274274

275275
async refreshSchema(): Promise<void> {
276-
await this.writeConnection?.refreshSchema();
276+
await this.initialized;
277+
await this.writeConnection!.refreshSchema();
277278

278279
for (let readConnection of this.readConnections) {
279280
await readConnection.connection.refreshSchema();

0 commit comments

Comments
 (0)