@syncular/server-workers 0.16.1 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +17 -15
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -101,21 +101,23 @@ See `wrangler.toml.example` for the binding config.
101
101
 
102
102
  ## Schema migration (D1)
103
103
 
104
- `D1ServerStorage` does **not** apply its DDL on construction (a cold request
105
- must never race a schema apply). Apply it once with wrangler. Generate the
106
- migration SQL from `sqliteDdlStatements()` (exported from `@syncular/server`)
107
- into a `migrations/` file, then:
108
-
109
- ```sh
110
- wrangler d1 create syncular
111
- wrangler d1 migrations apply syncular
112
- ```
113
-
114
- The schema is plain SQLite DDL (shared with `bun:sqlite` via
115
- `sqlite-dialect.ts`), so it is portable across the two SQLite-family
116
- storages. Regenerate and apply a migration when upgrading Syncular adds a core
117
- table. The durable reaction queue uses `sync_reactions`; a Worker running a
118
- reaction planner or runner fails closed if that migration is absent.
104
+ Run `storage.migrateSchema(compileSchema(schema))` from an authenticated
105
+ maintenance handler before admitting sync traffic. The method creates core
106
+ and application tables and rewrites stored rows. It returns
107
+ `{ complete, statementsExecuted }`; call it again in a new Worker invocation
108
+ when `complete` is false.
109
+
110
+ Each call defaults to 50 statements. Set `{ maxStatements: 40 }` to leave
111
+ room for other queries, or choose another integer from 10 through 1000 for
112
+ your D1 plan. Run at most one call per invocation. Progress and row updates
113
+ commit together, so interrupted requests can resume with the same schema.
114
+ The storage rejects row reads and transaction commits during migration.
115
+
116
+ `ensureSchema` performs one step and throws
117
+ `sync.storage.schema_migration_pending` when another invocation is needed.
118
+ Drain older Syncular deployments before starting an upgrade: they do not
119
+ check the migration state. See [the migration guide](https://syncular.dev/server-workers/#schema-migration)
120
+ for a maintenance handler and the remaining D1 limits.
119
121
 
120
122
  ## Storage: D1 (`D1ServerStorage`)
121
123
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncular/server-workers",
3
- "version": "0.16.1",
3
+ "version": "0.17.0",
4
4
  "description": "Cloudflare Workers adapter for the Syncular sync server",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Benjamin Kniffler",
@@ -45,10 +45,10 @@
45
45
  "!dist/**/*.test.d.ts"
46
46
  ],
47
47
  "dependencies": {
48
- "@syncular/server": "0.16.1",
49
- "@syncular/server-hono": "0.16.1"
48
+ "@syncular/server": "0.17.0",
49
+ "@syncular/server-hono": "0.17.0"
50
50
  },
51
51
  "devDependencies": {
52
- "@syncular/core": "0.16.1"
52
+ "@syncular/core": "0.17.0"
53
53
  }
54
54
  }