Skip to content

Commit 3c2b4d2

Browse files
authored
[Fix] refreshSchema not working correctly in web (#58)
* Updated web database implementation to match native implementation for get/getOptional. Using getAll for refreshSchema * chore(release): publish packages - [email protected] - [email protected]
1 parent 0623505 commit 3c2b4d2

File tree

7 files changed

+42
-6
lines changed

7 files changed

+42
-6
lines changed

Diff for: CHANGELOG.md

+28
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,34 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## 2024-08-21
7+
8+
### Changes
9+
10+
---
11+
12+
Packages with breaking changes:
13+
14+
- There are no breaking changes in this release.
15+
16+
Packages with other changes:
17+
18+
- [`sqlite_async` - `v0.8.3`](#sqlite_async---v083)
19+
- [`drift_sqlite_async` - `v0.1.0-alpha.6`](#drift_sqlite_async---v010-alpha6)
20+
21+
Packages with dependency updates only:
22+
23+
> Packages listed below depend on other packages in this workspace that have had changes. Their versions have been incremented to bump the minimum dependency versions of the packages they depend upon in this project.
24+
25+
- `drift_sqlite_async` - `v0.1.0-alpha.6`
26+
27+
---
28+
29+
#### `sqlite_async` - `v0.8.3`
30+
31+
- Updated web database implementation for get and getOptional. Fixed refreshSchema not working in web.
32+
33+
634
## 2024-08-20
735

836
### Changes

Diff for: packages/drift_sqlite_async/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.1.0-alpha.6
2+
3+
- Update a dependency to the latest release.
4+
15
## 0.1.0-alpha.5
26

37
- Update a dependency to the latest release.

Diff for: packages/drift_sqlite_async/pubspec.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: drift_sqlite_async
2-
version: 0.1.0-alpha.5
2+
version: 0.1.0-alpha.6
33
homepage: https://github.com/powersync-ja/sqlite_async.dart
44
repository: https://github.com/powersync-ja/sqlite_async.dart
55
description: Use Drift with a sqlite_async database, allowing both to be used in the same application.
@@ -15,7 +15,7 @@ environment:
1515
sdk: ">=3.0.0 <4.0.0"
1616
dependencies:
1717
drift: ">=2.15.0 <2.19.0"
18-
sqlite_async: ^0.8.2
18+
sqlite_async: ^0.8.3
1919
dev_dependencies:
2020
build_runner: ^2.4.8
2121
drift_dev: ">=2.15.0 <2.19.0"

Diff for: packages/sqlite_async/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.8.3
2+
3+
- Updated web database implementation for get and getOptional. Fixed refreshSchema not working in web.
4+
15
## 0.8.2
26

37
- **FEAT**: Added `refreshSchema()`, allowing queries and watch calls to work against updated schemas.

Diff for: packages/sqlite_async/lib/src/sqlite_queries.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,6 @@ mixin SqliteQueries implements SqliteWriteContext, SqliteConnection {
140140

141141
@override
142142
Future<void> refreshSchema() {
143-
return get("PRAGMA table_info('sqlite_master')");
143+
return getAll("PRAGMA table_info('sqlite_master')");
144144
}
145145
}

Diff for: packages/sqlite_async/lib/src/web/database.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class _SharedContext implements SqliteReadContext {
150150
@override
151151
Future<Row> get(String sql, [List<Object?> parameters = const []]) async {
152152
final results = await getAll(sql, parameters);
153-
return results.single;
153+
return results.first;
154154
}
155155

156156
@override
@@ -169,7 +169,7 @@ class _SharedContext implements SqliteReadContext {
169169
Future<Row?> getOptional(String sql,
170170
[List<Object?> parameters = const []]) async {
171171
final results = await getAll(sql, parameters);
172-
return results.singleOrNull;
172+
return results.firstOrNull;
173173
}
174174

175175
void markClosed() {

Diff for: packages/sqlite_async/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: sqlite_async
22
description: High-performance asynchronous interface for SQLite on Dart and Flutter.
3-
version: 0.8.2
3+
version: 0.8.3
44
repository: https://github.com/powersync-ja/sqlite_async.dart
55
environment:
66
sdk: ">=3.4.0 <4.0.0"

0 commit comments

Comments
 (0)