Jira のすべてのカスタム フィールド設定とカスタム フィールド値をデータベースから取得する
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
Server* 製品のサポートは 2024 年 2 月 15 日をもって終了します。Server 製品を利用している場合は、Atlassian Server のサポート終了のお知らせページにて移行オプションをご確認ください。
*Fisheye および Crucible は除く
要約
インスタンスに存在するすべてのカスタム フィールド設定とフィールド値を取得する必要がある
環境
現在サポートされているすべての Jira Server および Data Center バージョン
診断
Jira にはこれを実現するネイティブ機能はないため、データベースに直接クエリを実行する必要があります。
ソリューション
ビジネス インテリジェンスでの SQL の使用はアトラシアン サポートの範囲外であり、次の情報は現状のまま提供されます。
データベースの変更を行う場合は必ず事前にバックアップを取得してください。可能な場合は、まずステージング サーバーで SQL コマンドの変更、挿入、更新、または削除を行うようにします。
Jira インスタンスに設定されているすべてのカスタム フィールド定義を取得する
select cf.id, cf.cfname, cf.description, cfo.customvalue, cfo.disabled from customfield as cf join customfieldoption as cfo on cf.id = cfo.customfield
Jira インスタンスのすべての課題のすべてのカスタム フィールド値データを取得する
select CONCAT(p.pkey,'-',ji.issuenum) as issue_key, cf.cfname, cf.id as custom_field_id, cf.description, cfv.stringvalue, cfv.numbervalue, cfv.textvalue, cfv.datevalue, cfv.valuetype from customfield as cf join customfieldvalue as cfv on cf.id = cfv.customfield join jiraissue as ji on cfv.issue = ji.id join project p on p.id = ji.project
To retrieve all issues to a specific custom field name (exclude select list field that has option values):
select CONCAT(p.pkey,'-',ji.issuenum) as issue_key, cf.cfname, cf.id as custom_field_id, cf.description, cfv.stringvalue, cfv.numbervalue, cfv.textvalue, cfv.datevalue, cfv.valuetype from customfield as cf join customfieldvalue as cfv on cf.id = cfv.customfield join jiraissue as ji on cfv.issue = ji.id join project p on p.id = ji.project where cf.cfname = 'CUSTOMFIELDNAME';
To retrieve all issues from a select list field type of the existing options values:
select CONCAT(p.pkey,'-',ji.issuenum) as issue_key, cf.cfname, cf.id as custom_field_id, cf.description, cfo.customvalue, cfv.stringvalue, cfv.numbervalue, cfv.textvalue, cfv.datevalue, cfv.valuetype from customfield as cf join customfieldvalue as cfv on cf.id = cfv.customfield join customfieldoption as cfo on cfo.id = CAST (cfv.stringvalue AS INTEGER) join jiraissue as ji on cfv.issue = ji.id join project p on p.id = ji.project where cf.cfname = 'CUSTOMFIELDNAME';