Conversation
🦋 Changeset detectedLatest commit: a6df8e5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
packages/node/tests/sync.test.ts
Outdated
| const customSchema = new Schema({}); | ||
| customSchema.withRawTables({ | ||
| lists: { | ||
| tableName: 'lists' |
There was a problem hiding this comment.
Is it possible for tableName to be optional here? It looks like there might be many cases where the object key and tableName would be the same.
There was a problem hiding this comment.
I've considered that as well.
In the end, I wanted to avoid this because existing documentation explicitly states that the key (lists) doesn't have to match the name of the local table because it only affects for which tables the custom statement would be used. So changing that now would assign new meaning to that same key which might be confusing.
Additionally, we need some type-safety to express that either:
- A table schema is given, in which case
putanddeleteare optional. - Otherwise,
putanddeleteare required.
If tableName was optional, lists: {} would be a valid definition.
I also want to make passing a schema with the table name an explicit choice since it expresses that the default inferred statements can be used (meaning that the user expects no data transformations in custom statements to be necessary). So this should be syntactically different from the developer just forgetting the put and delete statements.
There was a problem hiding this comment.
Tables can now be defined as withRawTables(users: { schema: {} }) to avoid specifying the name twice.
Still a bit of syntactic overhead there, but that might be fine to point out that schema can be customized further.
b81ee14 to
a6df8e5
Compare
This adds support for new raw table features for version 0.4.11 of the core extension. For more context, also see the Kotlin PR.
Raw tables can now be defined in two ways:
putanddeletestatements, like before.tableNamedescribing the name of the table in the local schema, which will make the sync client infer theputanddeletestatement (so they're optional, but can still be used to customize them).This also adds
RawTable.clear, which has been added in the previous core extension update.