# Need versioning for workflow type migration

**URL:** <https://community.temporal.io/t/need-versioning-for-workflow-type-migration/9217>\
**Category:** Community Support\
**Tags:** java-sdk, general-impl\
**Created:** [August 16, 2023, 8:26pm UTC](https://community.temporal.io/t/need-versioning-for-workflow-type-migration/9217 "2023-08-16T20:26:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![workflow](https://avatars.discourse-cdn.com/v4/letter/w/58956e/32.png) [@workflow](https://community.temporal.io/u/workflow)\
**Post date:** [August 16, 2023, 8:26pm UTC](https://community.temporal.io/t/need-versioning-for-workflow-type-migration/9217/1 "2023-08-16T20:26:43Z")

</div>

I asked a similar question before,

> [@Versioning - long running workflow to switch to another workflow](https://community.temporal.io/t/versioning-long-running-workflow-to-switch-to-another-workflow/6890):
>
> We currently have a long running workflow(with 40k instances) and this is how we schedule our workflow to run monthly with a sleep timer. val workflow = Workflow.newContinueAsNewStub(FirstWorkflow::class.java) workflow.execute(object) we want to switch to different workflow. we want all the 40K executions to switch to new workflow after versioning Continue-as-new. Will versioning like this suffices? val version = Workflow.getVersion("switchToSecondWorkflow", Workflow.DEFAULT\_V…

To give some context - our workflow has a wait period of a month, so for all executions to migrate to new workflow type with versioning, it will take at least a month.

```auto
  val version = Workflow.getVersion("switchToSecondWorkflow", Workflow.DEFAULT_VERSION, 1)
        if (version == Workflow.DEFAULT_VERSION) {
            val workflow = Workflow.newContinueAsNewStub(FirstWorkflow::class.java)
        workflow.execute(object)
        } else {
           val workflow = Workflow.newContinueAsNewStub(SecondWorkflow::class.java)
        workflow.execute(object)
       }

```

Wondering if versioning is absolutely required in this case or can we just do this as we are not modifying command sequence

From

```auto
 val workflow = Workflow.newContinueAsNewStub(FirstWorkflow::class.java)
        workflow.execute(object)

```

To

```auto
val workflow = Workflow.newContinueAsNewStub(SecondWorkflow::class.java)
        workflow.execute(object)

```

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [August 16, 2023, 8:44pm UTC](https://community.temporal.io/t/need-versioning-for-workflow-type-migration/9217/2 "2023-08-16T20:44:20Z")

</div>

I recommend using the new [worker versioning](https://docs.temporal.io/workers#worker-versioning) feature that covers upgrades when continue-as-new is called.

---

<div class="post-metadata">

**Author:** ![workflow](https://avatars.discourse-cdn.com/v4/letter/w/58956e/32.png) [@workflow](https://community.temporal.io/u/workflow)\
**Post date:** [August 16, 2023, 10:10pm UTC](https://community.temporal.io/t/need-versioning-for-workflow-type-migration/9217/3 "2023-08-16T22:10:47Z")

</div>

Looks like [worker versioning](https://docs.temporal.io/workers?_ga=2.191999658.142784907.1692129246-1047223122.1680550513#worker-versioning) feature is

- Introduced in Temporal Server version [1.21.0](https://github.com/temporalio/temporal/releases/tag/v1.21.0)
- Available in CLI version [0.10.0](https://github.com/temporalio/cli/releases/tag/v0.10.0)
- Available in [Go SDK](https://docs.temporal.io/dev-guide/go/versioning#worker-versioning) version [1.23.0](https://github.com/temporalio/sdk-go/releases/tag/v1.23.0)
- Available in [Java SDK](https://docs.temporal.io/dev-guide/java/versioning#worker-versioning) version [1.20.0](https://github.com/temporalio/sdk-java/releases/tag/v1.20.0)
- Available in [Python SDK](https://python.temporal.io/temporalio.worker.Worker.html) version [1.3.0](https://github.com/temporalio/sdk-python/releases/tag/1.3.0)
- Available in [.NET SDK](https://dotnet.temporal.io/api/Temporalio.Worker.TemporalWorkerOptions.html#Temporalio_Worker_TemporalWorkerOptions_UseWorkerVersioning) version [0.1.0-beta1](https://github.com/temporalio/sdk-dotnet/releases/tag/0.1.0-beta1)
- Not yet available in Temporal Cloud

we are on much older temporal server.

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [August 16, 2023, 10:37pm UTC](https://community.temporal.io/t/need-versioning-for-workflow-type-migration/9217/4 "2023-08-16T22:37:45Z")

</div>

I think you don’t need to version the continue-as-new type. But I would test.
