Skip to content

Commit a5b2905

Browse files
committed
Improving structure.
1 parent fbccebc commit a5b2905

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

src/content/docs/durable-objects/reference/durable-objects-migrations.mdx

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -139,19 +139,16 @@ To apply a Rename migration:
139139
renamed_classes = [{from = "<OldDurableObject>", to = "<UpdatedDurableObject>" }] # Array of rename directives
140140
```
141141
</WranglerConfig>
142+
142143
The Rename migration contains:
143144
- A `tag` to identify the migration.
144145
- The `renamed_classes` array, which contains objects with `from` and `to` properties.
145-
- `from` property is the name of the old Durable Object class.
146-
- `to` property is the name of the renamed Durable Object class.
146+
- `from` property is the old Durable Object class name.
147+
- `to` property is the renamed Durable Object class name.
147148
2. Reference the new Durable Object class name in your Worker code.
148149
3. Deploy the Worker.
149150
</Steps>
150151

151-
:::note
152-
To apply both migrations in the same deploy, add the migrations configuration and deploy the Worker.
153-
:::
154-
155152
<Details header = "Rename migration example">
156153

157154
To rename a Durable Object class, from `OldName` to `UpdatedName`, your `wrangler.toml / wrangler.json` file should look like the following:
@@ -209,16 +206,6 @@ To apply a Transfer migration:
209206
3. Deploy the Worker.
210207
</Steps>
211208

212-
:::caution[Important]
213-
- The destination class (the class that stored Durable Objects are being transferred to) for a Rename or Transfer migration must be exported by the deployed Worker.
214-
215-
- You should not create the destination Durable Object class before running a Rename or Transfer migration. The migration will create the destination class for you.
216-
217-
- After a Rename or Transfer migration, requests to the destination Durable Object class will have access to the source Durable Object's stored data.
218-
219-
- After a migration, any existing bindings to the original Durable Object class (for example, from other Workers) will automatically forward to the updated destination class. However, any Workers bound to the updated Durable Object class must update their Durable Object binding configuration in the `wrangler` configuration file for their next deployment.
220-
:::
221-
222209
<Details header = "Transfer migration example">
223210

224211
You can transfer stored Durable Objects from `DurableObjectExample` to `TransferredClass` from a Worker script named `OldWorkerScript`. The configuration of the `wrangler.toml / wrangler.json` file for your new Worker code (destination Worker code) would look like this:
@@ -238,7 +225,7 @@ transferred_classes = [{from = "DurableObjectExample", from_script = "OldWorkerS
238225
</WranglerConfig>
239226

240227
</Details>
241-
## Durable Object migrations configuration in the Wrangler configuration file
228+
## Migration Wrangler configuration
242229

243230
- Migrations are performed through the `[[migrations]]` configurations key in your `wrangler.toml` file or `migration` key in your `wrangler.json` file.
244231

@@ -252,6 +239,16 @@ transferred_classes = [{from = "DurableObjectExample", from_script = "OldWorkerS
252239

253240
- Each migration in the list can have multiple directives, and multiple migrations can be specified as your project grows in complexity.
254241

242+
:::caution[Important]
243+
- The destination class (the class that stored Durable Objects are being transferred to) for a Rename or Transfer migration must be exported by the deployed Worker.
244+
245+
- You should not create the destination Durable Object class before running a Rename or Transfer migration. The migration will create the destination class for you.
246+
247+
- After a Rename or Transfer migration, requests to the destination Durable Object class will have access to the source Durable Object's stored data.
248+
249+
- After a migration, any existing bindings to the original Durable Object class (for example, from other Workers) will automatically forward to the updated destination class. However, any Workers bound to the updated Durable Object class must update their Durable Object binding configuration in the `wrangler` configuration file for their next deployment.
250+
:::
251+
255252
:::note
256253
Note that `.toml` files do not allow line breaks in inline tables (the `{key = "value"}` syntax), but line breaks in the surrounding inline array are acceptable.
257254
:::

0 commit comments

Comments
 (0)