古いデータを失うことなく既存のカスタム フィールドのコンテキストを変更する

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

説明

データを入力済みの既存のカスタム フィールドのコンテキストを変更する必要がある場合があります。この操作では、コンテキストの変更後にこれまでのすべての課題を更新することが必要になる場合があり、データが失われる可能性があります。この操作により、カスタム フィールドを新しいバックエンド データで強制的に更新することで、Jira インターフェイスには変化が見られませんが、履歴データの整合性を確保することができます。

関連する不具合が次のチケットで追跡されています。 JRASERVER-62455 - Getting issue details... STATUS

シナリオ

"Example List" という名前の "選択リスト" カスタム フィールドが存在し、次の値が入力されています。

  • Value One
  • Value Two
  • Value Three
  • Value Four

既定値を持たない既存のコンテキストがあります。

"Example List" フィールドは "Example Project - No Default" と "Example Project - DefaulT" で使用されます。このフィールドは両方のプロジェクトで使用されているため、両方のプロジェクトに、このフィールドに値を持つ課題が存在します。

目標

"Example Project - Default" のカスタム フィールドに入力された値を失うことなく、"Example List" のコンテキストを変更します。

完了すると次のようになっているはずです。

プロジェクトカスタム フィールド既定値
Example Project - No DefaultExample List (古いコンテキスト)(なし)
Example Project - DefaultExample List (新しいコンテキスト)"Value Three"

言い換えると、"Example List" カスタム フィールドは同じままで、これまでに作成された課題の既存の値を持ちますが、"Example Project - Default" プロジェクトの新しい課題は "Example List" に既定値を持ちます。

"Example Project - No Default" は "Example List" カスタム フィールドのコンテキストの変更の影響を受けないため、特別な操作は不要です。


注意

テスト環境をお持ちの場合、Jira のライブ インスタンスを変更する前にそれを使用してテストを行ってください。テストの有無にかかわらず、先に進む前にデータのバックアップを作成することを強く推奨します。

Solution 1 - From custom context to custom context

This solution applies when you are moving between two custom contexts:

  1. "Example Project - Default" に新しいコンテキスト (既定値を持つもの) を割り当てます。
  2. Issues >> Search issues に移動します。
  3. "Example List" カスタム フィールドに入力されたそれぞれの値について、次の手順を実行します。
    1. JQL 検索: Project = "Example Project - Default" AND "Example List" = 任意の値
    2. [ツール] > [一括変更]
    3. すべての課題を選択して [次へ] をクリック
    4. [課題を編集] を選択して [次へ] をクリック
    5. "Example List" ボックスを選択して任意の値を選択し、[次へ] をクリック
    6. 変更を確認して [確認]
プロセスの例を展開して確認...

(info) "Value One" 値のプロセスは次のようになります。

  1. Issues >> Search Issues
  2. JQL Search: Project = "Example Project - Default" AND "Example List" = "Value One"
  3. [ツール] > [一括変更]
  4. すべての課題を選択して [次へ] をクリック
  5. [課題を編集] を選択して [次へ] をクリック
  6. "Example list" ボックスを選択して "Value One" を選択し、[次へ] をクリック
  7. すべての課題を "Value One" から "Value One" に更新することを確認し、[確認] をクリック


Solution 2 - From custom context to default (global) context

This solution applies when you want to change back into the default context:

  1. First, we have to identify the ID of the Custom field we want to modify. Go to Issues > Custom Fields > Affected Custom Field > Configure and take note of its ID from the URL (e.g., /secure/admin/ConfigureCustomField!default.jspa?customFieldId=10701)
  2. Then we will have to identify the IDs of the current context and the default scheme context, you can also verify and note this information from the URL, when configuring the context (e.g. /secure/admin/ManageConfigurationScheme!default.jspa?fieldConfigSchemeId=11001&customFieldId=10701)
  3. Now on the database you have to retrieve each individual option ID, that is associated with the custom field project-specific context and also from the default context:

    SELECT id,customvalue FROM customfieldoption where customfield = customFieldId AND customfieldconfig = fieldConfigSchemeId;  
  4. Note down all the IDs and values. Then remove the project-specific Context.
  5. Jira を停止します。
  6. When you delete the context the customOption IDs still remain, however they no longer link to any context, therefore it’s empty on the UI.
  7. If you recreate the context, a new set of IDs will be generated, which do not match the previously existing ones, still resulting in "data loss"
  8. What we aim do to now is to replace the IDs from the custom values of the delete context with equivalent ones from the default context. To achieve this, for EACH customvalue, perform the following:

    update customfieldvalue set stringvalue='DefaultContextcustomvalueID' where stringvalue ='CustomContextcustomvalueID';
  9. Start Jira, verify that the values are now displayed in the customfield

最終更新日 2022 年 6 月 30 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.