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.
@Nic Brough -Adaptavist- thanks for responding
The SQL script is expected to update all the user stories related in scope to update the customfield1234= 'xxxx' when the value is empty.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Seconded.
Stop using SQL.
Use API (java/rest)
Stop with this silliness.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So I post a question somewhat similar that I'm hoping you guys might have an answer to. I also am wanting to directly modify the database data BUT that is only because I cannot find any possible solution by using the API. I want to be able to update contexts for custom fields and also what screens are associated with those custom fields without ever touching the GUI. From my searching, Atlassian has deemed that functionality not useful and declined to ever add it to the API. I disagree with their decision while heatedly, but here we are. So in this case unless I have missed something is there a good way to do this by directly modifying this data in the database?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Uday,
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.