Skip to content

Commit b82fd4d

Browse files
committed
Switch Durable Object migrations to SQLite
Replace wrangler migration entries from `new_classes` to `new_sqlite_classes` across fixtures and READMEs and add a changeset documenting that partyserver now relies on SQLite-backed Durable Objects (synchronous storage). Update use-socket logic to track option changes while disabled, ensure correct socket creation/cleanup on re-enable and StrictMode/HMR, and always connect replacement sockets. Expand tests in partysocket to cover these re-enable, token-refresh, cleanup, and wire-level scenarios. Breaking: Durable Object namespaces must use `new_sqlite_classes` when deployed.
1 parent 10eaa26 commit b82fd4d

14 files changed

Lines changed: 390 additions & 13 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
"partyserver": minor
3+
---
4+
5+
Uses `ctx.storage.kv` (synchronous KV) internally to persist `Server.name` across cold starts. This requires SQLite-backed Durable Objects, so you must use `new_sqlite_classes` instead of `new_classes` in your wrangler configuration's `migrations` field.
6+
7+
**Breaking:** If your Durable Object namespace still uses `new_classes`, you will see the following runtime error:
8+
9+
> The storage.kv (synchronous KV) API is only available for SQLite-backed Durable Objects, but this object's namespace is not declared to use SQLite. You can use the older, asynchronous interface via methods of `storage` itself (e.g. `storage.get()`). Alternatively, to enable SQLite, change `new_classes` to `new_sqlite_classes` within the 'migrations' field in your wrangler.jsonc or wrangler.toml file.
10+
11+
**Note:** This migration cannot be reversed once deployed to production.

fixtures/globe/wrangler.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"migrations": [
1717
{
1818
"tag": "v1", // Should be unique for each entry
19-
"new_classes": ["Globe"]
19+
"new_sqlite_classes": ["Globe"]
2020
}
2121
]
2222
}

fixtures/hono/wrangler.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"migrations": [
1717
{
1818
"tag": "v1", // Should be unique for each entry
19-
"new_classes": ["Chat"]
19+
"new_sqlite_classes": ["Chat"]
2020
}
2121
]
2222
}

fixtures/lexical-yjs/wrangler.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"migrations": [
1717
{
1818
"tag": "v1",
19-
"new_classes": ["LexicalDocument"]
19+
"new_sqlite_classes": ["LexicalDocument"]
2020
}
2121
]
2222
}

fixtures/monaco-yjs/wrangler.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"migrations": [
1717
{
1818
"tag": "v1",
19-
"new_classes": ["MonacoServer"]
19+
"new_sqlite_classes": ["MonacoServer"]
2020
}
2121
]
2222
}

fixtures/node/wrangler.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"migrations": [
1414
{
1515
"tag": "v1",
16-
"new_classes": ["MyServer"]
16+
"new_sqlite_classes": ["MyServer"]
1717
}
1818
]
1919
}

fixtures/pubsub/wrangler.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"migrations": [
1717
{
1818
"tag": "v1",
19-
"new_classes": ["PubSubServer"]
19+
"new_sqlite_classes": ["PubSubServer"]
2020
}
2121
]
2222
}

fixtures/rpc-sanity/wrangler.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"migrations": [
1414
{
1515
"tag": "v1",
16-
"new_classes": ["MyServer"]
16+
"new_sqlite_classes": ["MyServer"]
1717
}
1818
]
1919
}

fixtures/tldraw/wrangler.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"migrations": [
1717
{
1818
"tag": "v1", // Should be unique for each entry
19-
"new_classes": ["Tldraw"]
19+
"new_sqlite_classes": ["Tldraw"]
2020
}
2121
]
2222
}

packages/hono-party/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ const socket = usePartySocket({
9191
{ "name": "Document", "class_name": "Document" }
9292
]
9393
},
94-
"migrations": [{ "tag": "v1", "new_classes": ["Chat", "Game", "Document"] }]
94+
"migrations": [
95+
{ "tag": "v1", "new_sqlite_classes": ["Chat", "Game", "Document"] }
96+
]
9597
}
9698
```
9799

0 commit comments

Comments
 (0)