Durable Objects · Exercise 03
Store data with SQL
Give a second Durable Object class its own SQLite database, store messages in it with SQL, and see that every object's database is separate.
Paste this into your agent
Copied! Now paste it into your agent. No agent yet? Here's how to get one.
Store data with SQL
The counter stored one number. Real apps store rows: messages, orders, edits to a document. Every SQLite-backed Durable Object comes with its own SQL database, right next to its code.
What you’ll build
A second Durable Object class, Room, that stores chat messages in a messages table with SQL, and a /room route to post and read them. Each room name gets its own database.
Prerequisites
- You’ve completed No lost updates and still have that Worker on disk.