Skip to content

Commit 6cb4834

Browse files
committed
Docs update
1 parent d016e6b commit 6cb4834

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 1.3.0 (unreleased)
44

55
* Support tables created outside of PowerSync with the `RawTable` API.
6+
For more information, see [the documentation](https://docs.powersync.com/usage/use-case-examples/raw-tables).
67
* Fix `runWrapped` catching cancellation exceptions.
78

89
## 1.2.2

core/src/commonMain/kotlin/com/powersync/db/schema/RawTable.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ import kotlinx.serialization.json.put
1818
*
1919
* A main benefit of raw tables is that, since they're not backed by JSON views, complex queries on
2020
* them can be much more efficient.
21+
* However, it's the responsibility of the developer to create these raw tables, migrate them when necessary and to
22+
* write triggers detecting local writes. For more information, see
23+
* [the documentation page](https://docs.powersync.com/usage/use-case-examples/raw-tables).
2124
*
2225
* Note that raw tables are only supported when [SyncOptions.newClientImplementation] is enabled.
2326
*/

core/src/commonMain/kotlin/com/powersync/db/schema/Schema.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import kotlinx.serialization.json.JsonElement
1111
* The implementation uses the schema as a "VIEW" on top of JSON data.
1212
* No migrations are required on the client.
1313
*/
14+
@ConsistentCopyVisibility
1415
@OptIn(ExperimentalPowerSyncAPI::class)
1516
public data class Schema internal constructor(
1617
val tables: List<Table>,
@@ -31,10 +32,14 @@ public data class Schema internal constructor(
3132
yieldAll(rawTables)
3233
}
3334

35+
// Kept for binary compatibility, the new constructor taking a BaseTable vararg will be used when recompiling.
36+
@Deprecated(level = DeprecationLevel.HIDDEN, message = "Use constructor taking BaseTable args instead")
37+
public constructor(vararg tables: Table) : this(tables.asList())
38+
3439
/**
3540
* Secondary constructor to create a schema with a variable number of tables.
3641
*/
37-
public constructor(vararg tables: Table) : this(tables.asList())
42+
public constructor(vararg tables: BaseTable) : this(tables.asList())
3843

3944
/**
4045
* Validates the schema by ensuring there are no duplicate table names

core/src/commonMain/kotlin/com/powersync/sync/SyncStream.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,10 @@ internal class SyncStream(
441441
val scope: CoroutineScope,
442442
) {
443443
suspend fun streamingSyncIteration() {
444+
check(schema.rawTables.isEmpty()) {
445+
"Raw tables are only supported by the Rust sync client."
446+
}
447+
444448
val bucketEntries = bucketStorage.getBucketStates()
445449
val initialBuckets = mutableMapOf<String, String>()
446450

0 commit comments

Comments
 (0)