Handling duplicate fields error
In some special cases, there may occur an error about duplicated fields in your database. This might be caused by some unintentional changes in database eg. Jira upgrade, database updates, database change, etc. or maybe were caused by some app managing custom fields. In The Scheduler such complications will lead to the inability to perform actions as deleting or editing Scheduled Issue.
To fix this issue you need to check your database to ensure everything is in order. The most common reason for this error is duplicated fields with identical IDs. You can either check and fix this yourself (if you have appropriate permissions with your organization) or reach out to your database manager for assistance.
Disclaimer - examples below are provided “as is" without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose.
We strongly recommend that you’ll create backup before running those scripts in case of data corruption.
Be aware that duplicated custom fields may affect Scheduled Issue data. For example, if you want to edit SI with duplicated custom fields, you will get an error and your issue details (like summary, description) may be removed.
Here are two examples of SQL script to remove duplicated records - you’ll probably need to adjust it a bit to match your database.
MariaDB
CREATE TEMPORARY TABLE A406ED_TEMP_TABLE AS SELECT DISTINCT * FROM AO_A406ED_FIELD_V2; TRUNCATE TABLE AO_A406ED_FIELD_V2; INSERT INTO AO_A406ED_FIELD_V2 (`FIELD_CLASS_NAME`, `FIELD_NAME`, `ID`, `SCHEDULED_ISSUE_ID`, `SCHEDULED_SUBTASK_ID`, `SI_SUBTASK_ENTITY_ID`, `SI_SUBTASK_ID`) SELECT * FROM A406ED_TEMP_TABLE; DROP TEMPORARY TABLE IF EXISTS A406ED_TEMP_TABLE; COMMIT;
PostgreSQL
START TRANSACTION; CREATE TEMPORARY TABLE A406ED_TEMP_TABLE AS SELECT DISTINCT * FROM "AO_A406ED_FIELD_V2"; TRUNCATE TABLE "AO_A406ED_FIELD_V2"; INSERT INTO "AO_A406ED_FIELD_V2" ("FIELD_CLASS_NAME", "FIELD_NAME", "ID", "SCHEDULED_ISSUE_ID", "SCHEDULED_SUBTASK_ID", "SI_SUBTASK_ENTITY_ID", "SI_SUBTASK_ID") SELECT * FROM A406ED_TEMP_TABLE; DROP TABLE IF EXISTS A406ED_TEMP_TABLE; COMMIT;
If this does not fix your problem, please contact our support team by submitting a ticket along with relevant logs, we will do our best to help you.
Feel free to tell us what topic should be covered: thescheduler@psc-software.atlassian.net