How to change the issue creation date using a database update

お困りですか?

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

コミュニティに質問

The content on this page relates to database updates which are not supported by our Atlassian Support Offerings. Consequently, Atlassian can not guarantee providing any support for it. Please be aware that this material is provided for your information only and using it is done so at your own risk.

プラットフォームについて: Server と Data Center のみ - この記事は、サーバーおよびデータセンター プラットフォームのアトラシアン製品にのみ適用されます。

目的

Sometimes the creation date of an issue may need to be modified after the issue has been created. This article covers how to do this using a database update.

ソリューション

Database updates are not supported and can result in integrity issues. We recommend to use the CSV import functionality as described in How to change the issue creation date using CSV import instead.


Preparation:

  1. Create a Date Picker Custom Field called Alternate Creation Date, set it to the project that you need to modify, and apply it to the Default Screen.
  2. Browse to the issue you want to modify.
  3. Click on Edit, look for the Alternate Creation Date field on the Edit Issue screen and set the desired created date on it.
  4. Update the issue and check if the change has been applied.
  5. Repeat this process to all the issues you want to modify.

Perform the database update:

データベースの変更を行う場合は必ず事前にバックアップを取得してください。可能な場合は、まずステージング サーバーで SQL コマンドの変更、挿入、更新、または削除を行うようにします。


  1. Stop your JIRA application.
  2. Execute the below SQL to perform the update. Repeat this step for every issue that requires updating.

    Click here to expand for JIRA 6.1 and higher...

    Replace the references to ABC with the project key and 123 with the issue number.

    UPDATE jiraissue
    SET    created = (SELECT datevalue
                  FROM   customfieldvalue
                  WHERE  issue = (SELECT id
                                FROM   jiraissue
                                WHERE  issuenum = '123'
                                AND    project = (SELECT id
                                              FROM   project
                                              WHERE  pkey = 'ABC')
                                AND    customfield = (SELECT id
                                              FROM   customfield
                                              WHERE  cfname LIKE 'Alternate Creation Date'))
                  where  issuenum = '123'
                  AND    project = (SELECT id
                                FROM   project
                                WHERE  pkey = 'ABC');

    This was tested on PostgreSQL and may require modifying based on the DBMS used. Please consult with your DBA on the appropriate syntax.

    Click here to expand for JIRA 6.1 and lower...

    Replace the ABC-123 for the issue key you want to modify.

    UPDATE jiraissue 
    SET    created = (SELECT datevalue 
                      FROM   customfieldvalue 
                      WHERE  issue = (SELECT id 
                                      FROM   jiraissue 
                                      WHERE  pkey = 'ABC-123') 
                             AND customfield = (SELECT id 
                                                FROM   customfield 
                                                WHERE 
                                 cfname LIKE 'Alternate Creation Date')) 
    WHERE  pkey = 'ABC-123';

    This was tested on PostgreSQL and may require modifying based on the DBMS used. Please consult with your DBA on the appropriate syntax.

  3. Start the application and perform a full reindex. This is required as the indexes for the created date will be out of sync with the database.

  4. Check if the creation date has been changed, for example:
  5. Remove the custom field Alternate Creation Date and the issue update will be complete.

最終更新日 2018 年 11 月 16 日

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

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