---
url: "https://vueda.dev/v3/reference/api/py/vueda.workflow.management.commands.updateworkflowmigrations.md"
title: "commands.updateworkflowmigrations"
---

# commands.updateworkflowmigrations

## Overview

Management command for updating existing workflow migrations with current function implementations.

## Classes

- [Command](/v3/reference/api/py/vueda.workflow.management.commands.updateworkflowmigrations/Command.md)

## `add_workflow_identities` {#add_workflow_identities}

Copy a change, adding the app and model to every workflow it names by code alone.

### Signature {#add_workflow_identities-signature}

`add_workflow_identities(value, identities, recorded_at, names_a_workflow)`

#### Parameters {#add_workflow_identities-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="add_workflow_identities-param-value">value</span> |  | yes |  |  |
| <span id="add_workflow_identities-param-identities">identities</span> |  | yes |  |  |
| <span id="add_workflow_identities-param-recorded_at">recorded_at</span> |  | yes |  |  |
| <span id="add_workflow_identities-param-names_a_workflow">names_a_workflow</span> |  | no | `False` |  |

### Source {#add_workflow_identities-source}

`server/vueda/workflow/management/commands/updateworkflowmigrations.py:219`

## `add_workflow_identities_to_changed_data` {#add_workflow_identities_to_changed_data}

Return the changes with every workflow reference naming the app and model as well as the code.

### Signature {#add_workflow_identities_to_changed_data-signature}

`add_workflow_identities_to_changed_data(changed_data, identities)`

#### Parameters {#add_workflow_identities_to_changed_data-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="add_workflow_identities_to_changed_data-param-changed_data">changed_data</span> |  | yes |  |  |
| <span id="add_workflow_identities_to_changed_data-param-identities">identities</span> |  | yes |  |  |

### Source {#add_workflow_identities_to_changed_data-source}

`server/vueda/workflow/management/commands/updateworkflowmigrations.py:247`

## `collect_workflow_identities` {#collect_workflow_identities}

Return the identities each workflow code has had, in the order they were recorded.

A code can be released by one model and taken over by another, so a code maps to a list rather
than to one identity, and which entry a reference means depends on when that reference was
recorded.

Each entry also records whether the workflow it names took the code at that change: one added
with the code, or one whose code was changed to it. Every other change to a workflow records an
entry too, under the code it already held, and can name a different app or model when the
workflow's own changed. Telling the two apart is what shows whether one workflow or several have
held a code.

### Signature {#collect_workflow_identities-signature}

`collect_workflow_identities(changed_data_lists)`

#### Parameters {#collect_workflow_identities-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="collect_workflow_identities-param-changed_data_lists">changed_data_lists</span> |  | yes |  |  |

### Source {#collect_workflow_identities-source}

`server/vueda/workflow/management/commands/updateworkflowmigrations.py:146`

## `describe_unreadable_changes` {#describe_unreadable_changes}

Return why the command cannot read a migration's changes, or ``None`` when it can.

A migration's ``changed_data`` can import and still not hold what the command reads from each
change, when it has been edited by hand. Checking every change before any is used lets the file
be reported and skipped, instead of a missing key ending the whole run with no file named.

### Signature {#describe_unreadable_changes-signature}

`describe_unreadable_changes(changed_data)`

#### Parameters {#describe_unreadable_changes-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="describe_unreadable_changes-param-changed_data">changed_data</span> |  | yes |  |  |

### Source {#describe_unreadable_changes-source}

`server/vueda/workflow/management/commands/updateworkflowmigrations.py:83`

## `get_installed_package_paths` {#get_installed_package_paths}

Return the directories packages are installed into, normalized for comparison.

A migration under one of them belongs to a package, so the project cannot commit a rewrite of it,
and reinstalling the package puts the original back. An editable install leaves its files in their
source tree, so it is not under any of these.

Besides the environment's own package directories, these include the base interpreter's, which a
virtual environment created with ``--system-site-packages`` also imports from, and the user site
directory that ``pip install --user`` installs into.

On Windows, ``site.getsitepackages`` lists each prefix itself alongside its ``Lib\site-packages``.
A prefix holds far more than packages, so counting it would treat a project kept inside a Python
install, such as a portable or embedded one, as installed. The prefixes are left out.

### Signature {#get_installed_package_paths-signature}

`get_installed_package_paths()`

### Source {#get_installed_package_paths-source}

`server/vueda/workflow/management/commands/updateworkflowmigrations.py:45`

## `has_naive_history_dates` {#has_naive_history_dates}

Return whether any change records a date with no time zone.

### Signature {#has_naive_history_dates-signature}

`has_naive_history_dates(changed_data)`

#### Parameters {#has_naive_history_dates-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="has_naive_history_dates-param-changed_data">changed_data</span> |  | yes |  |  |

### Source {#has_naive_history_dates-source}

`server/vueda/workflow/management/commands/updateworkflowmigrations.py:123`

## `is_installed_package_path` {#is_installed_package_path}

Return whether a path is inside a directory packages are installed into.

### Signature {#is_installed_package_path-signature}

`is_installed_package_path(path)`

#### Parameters {#is_installed_package_path-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="is_installed_package_path-param-path">path</span> |  | yes |  |  |

### Source {#is_installed_package_path-source}

`server/vueda/workflow/management/commands/updateworkflowmigrations.py:77`

## `recorded_at_utc` {#recorded_at_utc}

Return a recorded date that can be compared with the dates other migrations recorded.

Every date a generated migration records carries a time zone, so a naive one reached the file by
hand. UTC is what the generated ones hold, so reading a naive date as UTC keeps it comparable
and puts it where its author meant it to sit. The date in the file is left as it was written.

### Signature {#recorded_at_utc-signature}

`recorded_at_utc(recorded)`

#### Parameters {#recorded_at_utc-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="recorded_at_utc-param-recorded">recorded</span> |  | yes |  |  |

### Source {#recorded_at_utc-source}

`server/vueda/workflow/management/commands/updateworkflowmigrations.py:110`

## `workflow_identity_at` {#workflow_identity_at}

Return what a workflow code meant when a change naming it was recorded, or ``None`` when that cannot be told.

### Signature {#workflow_identity_at-signature}

`workflow_identity_at(identities, code, recorded_at)`

#### Parameters {#workflow_identity_at-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="workflow_identity_at-param-identities">identities</span> |  | yes |  |  |
| <span id="workflow_identity_at-param-code">code</span> |  | yes |  |  |
| <span id="workflow_identity_at-param-recorded_at">recorded_at</span> |  | yes |  |  |

### Source {#workflow_identity_at-source}

`server/vueda/workflow/management/commands/updateworkflowmigrations.py:193`

## `workflow_identity_of` {#workflow_identity_of}

Return the app and model a workflow change names, exactly as the change recorded them.

A field the change altered is returned as the ``(old, new)`` pair it is recorded as, because
the workflow's own id is read with ``get_id_values_from_dict``, which picks the side the
direction of travel calls for.

A change that recorded neither column names a workflow whose columns are blank: replaying the
change creates the row through a migration-state model, which has none of the ``save()`` that
fills those columns in, so blank is what the row ends up holding. ``makeworkflowmigrations``
writes the workflow's own id the same way, so a reference has to agree with it to match.

### Signature {#workflow_identity_of-signature}

`workflow_identity_of(changes)`

#### Parameters {#workflow_identity_of-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="workflow_identity_of-param-changes">changes</span> |  | yes |  |  |

### Source {#workflow_identity_of-source}

`server/vueda/workflow/management/commands/updateworkflowmigrations.py:131`

## Source

`server/vueda/workflow/management/commands/updateworkflowmigrations.py`
