Durable Object Class Exports, SQLite Storage, Lifecycle, and Migrations
How to declare Durable Object classes with exports, use SQLite storage, and manage create, rename, delete, and transfer without legacy migration tags.
This page summarises Cloudflare documentation on managing Durable Object class lifecycle: the declarative exports field in Wrangler, the SQLite storage backend for new namespaces, and how that relates to the legacy migrations array. It also covers practical limits, rollout patterns, and where the beta @cloudflare/actors library fits.
What exports is and why it replaced migration tags
Section titled “What exports is and why it replaced migration tags”The exports field in your Wrangler configuration file is the declarative way to manage Durable Object class lifecycle. You declare each class your Worker exports—live, deleted, renamed, or transferred—and Cloudflare reconciles that declaration against namespaces already provisioned for the Worker.
A new declarative exports field in your Wrangler configuration file replaces the imperative migrations array for managing Durable Object class lifecycle. Instead of writing an ordered list of migration steps with unique tags, you declare each Durable Object class your Worker exports and Cloudflare compares that against what’s already deployed to determine what Durable Object state needs to be created, renamed, or deleted.
— Cloudflare, Declare Durable Object class lifecycle with
exports
Compared with legacy migrations, Cloudflare highlights: no migration tags (the current exports map is the source of truth), structured deployment output from wrangler deploy, first-class zero-downtime rename and transfer patterns via tombstones, and cross-Worker safety when deleting or renaming (referencing scripts are listed). See Durable Object class exports and the Wrangler Exports reference.
exports and the legacy migrations array are mutually exclusive in one Worker configuration. Existing Workers on migrations keep working; moving to exports is a configuration-shape change, not a data migration—provisioned namespaces stay in place. After you deploy with exports, you cannot return to migrations on later deploys. See Migrate from the legacy migrations flow.
SQLite storage: what new Durable Object namespaces must use
Section titled “SQLite storage: what new Durable Object namespaces must use”New Durable Object namespaces should use the SQLite storage backend. SQLite-backed objects retain key-value storage API parity and add SQL and point-in-time recovery (restore embedded SQLite contents to any point in the past 30 days). Each object can hold up to 10GB SQLite per Durable Object where GA applies.
If your account does not already have a key-value (KV) backed Durable Object namespace, you can no longer create new ones. New Durable Object namespaces must use the SQLite storage backend, which has been recommended for all new Durable Objects since it became generally available in 2024.
— Cloudflare, New Durable Object namespaces must use the SQLite storage backend
| Plan / account situation | New namespace backend | Notes |
|---|---|---|
| Workers Free | SQLite only | Free plan has only ever supported SQLite-backed Durable Objects (changelog). |
| Paid, no existing KV-backed namespace | SQLite only (new_sqlite_classes or exports with "storage": "sqlite") |
new_classes / legacy-kv via exports fails for new namespaces. |
| Paid, already has KV-backed namespace | Can still create additional KV namespaces for now | Part of a move toward SQLite as the single backend; KV→SQLite path for existing classes is planned. |
Storage type is immutable once a namespace exists: switching sqlite ↔ legacy-kv in exports yields storage_type_mismatch. To change backends you must delete the namespace (data loss) and re-provision. See Storage backends.
How to access SQLite in code
Section titled “How to access SQLite in code”SQL is available on ctx.storage.sql in the constructor. For SQLite-backed classes declared with legacy migrations, use new_sqlite_classes in Wrangler (Access Durable Objects Storage). For new projects, declare the class in exports as in Getting started.
exports lifecycle states: create, delete, rename, transfer
Section titled “exports lifecycle states: create, delete, rename, transfer”When you deploy a Worker that declares exports, Cloudflare compares your code (exported classes), your exports configuration, and provisioned state. A class only in code is ignored until declared in exports; disagreements surface as errors or applied actions. See How exports works.
| Operation | state |
Required fields |
|---|---|---|
| New live class (default) | omitted or "created" |
storage ("sqlite" for new namespaces) |
| Delete class | "deleted" |
— |
| Rename class | "renamed" |
renamed_to (must be a live entry in the same map) |
| Send namespace to another Worker | "transferred" |
transferred_to |
| Receive namespace from another Worker | "expecting-transfer" |
storage, transfer_from |
Define a new Durable Object class with exports
Section titled “Define a new Durable Object class with exports”Add the class in Worker code, add a durable_objects binding if needed, and declare a live entry:
"exports": { "MyDurableObject": { "type": "durable-object", "storage": "sqlite" }}Deploy with npx wrangler deploy. Cloudflare provisions the namespace on first deploy; unchanged entries on later deploys only confirm the class is still live. See Define a Durable Object class.
Before a deleted tombstone deploys: remove the class from code, remove bindings, and ensure no other Worker in the account still binds to that namespace—otherwise deploy fails with tombstone_delete_blocked_by_external_bindings.
Rename without downtime: three-deploy pattern
Section titled “Rename without downtime: three-deploy pattern”Renaming moves stored data between class names in the same Worker. Because namespace pointer and code rollout are not perfectly atomic for a few seconds, Cloudflare documents a three-deploy pattern: alias NewName as OldName in code, apply renamed tombstone plus live NewName while the alias remains, then remove the alias. Tombstone applied while the old class name is still exported triggers an expected tombstone_class_still_in_code info notice. See Avoid downtime during a rename.
Agent-style Workers use the same tombstone pattern; see Renaming an agent class.
Transfer between Workers: four-deploy pattern
Section titled “Transfer between Workers: four-deploy pattern”Transfer requires coordination: target Worker declares expecting-transfer with transfer_from; source later deploys transferred with transferred_to. Recommended order and binding timing are spelled out in Transfer a Durable Object class between Workers. Constraints include same account, no cross-dispatch-namespace transfer, and one pending phase-1 hint per class on the target.
Legacy migrations array: when it still applies
Section titled “Legacy migrations array: when it still applies”For Workers not yet on exports, lifecycle still uses an ordered migrations list with unique tag values. Each tag applies once per environment. You must run a migration when you create, rename, delete, or transfer a class—not when you only change class code or storage access patterns (Durable Object class migrations (legacy)).
Create with SQLite:
"migrations": [ { "tag": "v1", "new_sqlite_classes": ["MyDurableObject"] }]Duplicate migration tags are invalid; see Migration tag conflict. Environments can override top-level migrations (Environments).
Equivalent after moving to exports for a single live class:
"exports": { "ChatRoom": { "type": "durable-object", "storage": "sqlite" }}Deploy constraints: wrangler deploy vs gradual versions
Section titled “Deploy constraints: wrangler deploy vs gradual versions”Lifecycle changes are atomic at the control plane and only apply through wrangler deploy, not wrangler versions upload:
Uploading a version that changes Durable Object class lifecycle is not supported. This applies to both the declarative exports field and the legacy migrations array - any change that creates, deletes, renames, or transfers a Durable Object class must be applied through wrangler deploy.
— Cloudflare, Deployment management
Gradual deployments cannot roll out class lifecycle changes; rollbacks cannot cross a lifecycle change (Gradual deployments with Durable Objects). Deploy lifecycle changes separately from unrelated code to limit blast radius.
Reading wrangler deploy reconciliation output
Section titled “Reading wrangler deploy reconciliation output”When lifecycle changes apply (or when there are notices), Wrangler prints a Durable Object exports reconciliation block: created/renamed/transferred lines, info notices (stale tombstones, zero-downtime rename hints), and Safe to remove from exports for tombstones with no referencing_scripts. Failed deploys report structured errors per class (for example orphaned_provisioned_namespace, provisioned_class_missing_from_config). See Reading the reconciliation output and the Error reference.
Design and storage practices alongside lifecycle config
Section titled “Design and storage practices alongside lifecycle config”Cloudflare’s Rules of Durable Objects recommends one Durable Object per logical coordination unit (room, session, user), SQLite with typed RPC methods, understanding input/output gates, and Hibernatable WebSockets for real-time cost control. Run SQL schema migrations in the constructor inside blockConcurrencyWhile() so initialization races do not run before schema is ready; PRAGMA user_version is not supported—track versions via a _sql_schema_migrations table or libraries such as durable-utils or @cloudflare/actors storage helpers.
The beta @cloudflare/actors package adds Storage helpers (SQL templates, schema migrations), alarm helpers, and an Actor class pattern that can generate the Worker entry for you, with routing via nameFromRequest. The low-level Durable Objects Workers API remains available when you do not use Actor.
For Workers that call Durable Objects, colocate work inside the object—embedded SQLite queries run with compute and data in the same process (Placement). Tests can use @cloudflare/vitest-pool-workers with runDurableObjectAlarm (Rules of Durable Objects changelog).
Common mistakes when managing class lifecycle
Section titled “Common mistakes when managing class lifecycle”- Declaring a class in code but omitting it from
exports, leading toprovisioned_class_missing_from_configor ignored provisioning. - Using both
exportsandmigrationsin one Worker (configuration rejected). - Attempting
new_classeson accounts restricted to SQLite (error message). - Deleting a class while it is still exported or while other Workers bind to it.
- Expecting
wrangler versions uploadto apply lifecycle changes—usewrangler deployinstead. - Renaming in one deploy without the three-deploy alias pattern, causing brief runtime resolution errors.
- For legacy flows: deleting a class before removing bindings (troubleshooting).
How to check this on your site
Section titled “How to check this on your site”-
Confirm each exported Durable Object class has a matching entry in
exports(or a deliberate tombstone) and that you are not mixingexportswith legacymigrations, using the Wrangler configuration schema as reference. -
For new namespaces, verify
"storage": "sqlite"(ornew_sqlite_classeson legacy Workers) and that deploy does not request new key-value namespaces on restricted accounts. -
Run
npx wrangler deployin a staging environment and read the Durable Object exports reconciliation block for created/renamed/deleted actions, errors, and entries safe to remove (reconciliation output). -
After lifecycle changes, exercise bindings from every Worker that references the class; redeploy any Worker listed under
referencing_scriptsbefore removing tombstones. -
You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact statement you are asking about.