I would like to INSERT new values to custom field in JIRA DB, but when there is no value, I can not use UPDATE, because row doesn't exist.
Custom field type is "Select List (single choice)"
UPDATE jiraissue,customfieldvalue SET customfieldvalue.datevalue = jiraissue.created WHERE customfieldvalue.customfield = 'XXXXX' AND jiraissue.id = customfieldvalue.issue;
My goal is to INSERT new values to a custom filed with id 'XXXXX' for an Issue that has no value there.
correct me if I am missing anything here.
Stop, stop, stop! You should not even be looking at the database, it is almost always the totally wrong thing to do.
There are times when it's ok, but they are fixing data damaged by bugs, mucking with migrations and when Atlassian support tell you to.
Yes, you can update values in custom fields by running SQL, but in your question, you make no reference to what you would really need to do, so I suspect you are not doing everything that would be necessary.
To add a value to an empty field, you will need to:
In other words, don't look at the database. Use the REST API to make your updates, not SQL.
I think you may have missed the point of this, so I'll be quite blunt.
Stop using SQL.
It won't work unless you do what I said in my last post. And it needs you to completely understand the way Jira uses a database as a data-store (which I would guess that you do not, as you have not mentioned or questioned the sequencing stuff, the caching or how custom fields are stored)
You are missing the fact that this will cause problems elsewhere. All modifications to the DB should go through the app because there are secondary process that occur. I would shift methods from the database to the API for a path that avoids many pitfalls. Cheers!
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events