Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAs a developer I'd like some guidance on writing SQL upgrade scripts #5186
Comments
pdurbin
added
the
Status: This/Next Sprint
label
Oct 15, 2018
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@mheppler oh! It's called "scripts/database/5043-update.sql". Thanks! Is this the new way? Shall we document it in the dev guide? And explain the new way in a post to the "dataverse-dev" list? |
This comment has been minimized.
This comment has been minimized.
@pdurbin I think I just put it in that way since I didn't know what version it would become part of... If I should have done it differently, let me know... |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@qqmyers here's what I do:
Does that make sense? I could make a pull request to document this. Are you interested in making a pull request to remove scripts/database/5043-update.sql and put the statements in scripts/database/upgrades/upgrade_v4.9.4_to_v4.10.sql? I'm happy to do this if you want. Are you interested in emailing dataverse-dev about the update? I can do this too. Finally, since I'm bothering you, can you please take a quick peek at #5185? Thanks!! |
qqmyers
referenced this issue
Oct 15, 2018
Merged
provide guidance on running SQL upgrade scripts and do a little reorg #5189
pdurbin
added
Status: Code Review
and removed
Status: This/Next Sprint
labels
Oct 15, 2018
This comment has been minimized.
This comment has been minimized.
djbrooke
assigned
pdurbin
Oct 15, 2018
This comment has been minimized.
This comment has been minimized.
So to weigh in: we will discuss it here as a team and can provide some guidance going forward. |
pdurbin
assigned
scolapasta
and unassigned
pdurbin
Oct 15, 2018
This comment has been minimized.
This comment has been minimized.
@scolapasta makes sense. I'm assigning this to you to sort out. As long as we document the process. Thanks! |
This comment has been minimized.
This comment has been minimized.
@pdurbin So does this ticket cover actually renaming/ integrating this script into the update one then or is it more of a process discussion? |
This comment has been minimized.
This comment has been minimized.
@kcondon good question. Without a process I'm blocked on making SQL updates. I'm attempting to use the new process in pull request #5195 but as @scolapasta indicated we will be discussing this as a team. |
This comment has been minimized.
This comment has been minimized.
For this issue, we can use the current process of using the update script, if people prefer, so we can get it done and over. The more general discussion will happen in the next few weeks, I hope. |
scolapasta
removed their assignment
Oct 15, 2018
This comment has been minimized.
This comment has been minimized.
Ok, I'll document the process we've been using since I got here. |
pdurbin
self-assigned this
Oct 15, 2018
added a commit
to QualitativeDataRepository/dataverse
that referenced
this issue
Oct 16, 2018
This comment has been minimized.
This comment has been minimized.
As discussed at standup this morning I'll be adding some documentation of our existing process for writing SQL upgrade script. I'll tweak the title of this issue to reflect this. At standup we also agreed to remove scripts/database/3561-update.sql which leads contributors astray into thinking that's what we want. I did this in 7c67734 and had the thought that we could move the content into upgrade_v4.7.1_to_v4.8.sql and update the release notes at https://github.com/IQSS/dataverse/releases/tag/v4.8 but didn't want to make this decision unilaterally. |
pdurbin commentedOct 15, 2018
I just switched to the "develop" branch and could not deploy due to this error:
Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERROR: column "uri" does not exist
Position: 184
Error Code: 0
Call: SELECT ID, ADVANCEDSEARCHFIELDTYPE, ALLOWCONTROLLEDVOCABULARY, ALLOWMULTIPLES, description, DISPLAYFORMAT, DISPLAYONCREATE, DISPLAYORDER, FACETABLE, FIELDTYPE, name, REQUIRED, title, uri, VALIDATIONFORMAT, WATERMARK, METADATABLOCK_ID, PARENTDATASETFIELDTYPE_ID FROM DATASETFIELDTYPE ORDER BY ID
Query: ReadAllQuery(referenceClass=DatasetFieldType sql="SELECT ID, ADVANCEDSEARCHFIELDTYPE, ALLOWCONTROLLEDVOCABULARY, ALLOWMULTIPLES, description, DISPLAYFORMAT, DISPLAYONCREATE, DISPLAYORDER, FACETABLE, FIELDTYPE, name, REQUIRED, title, uri, VALIDATIONFORMAT, WATERMARK, METADATABLOCK_ID, PARENTDATASETFIELDTYPE_ID FROM DATASETFIELDTYPE ORDER BY ID")
It looks like the "uri" field was added to the "datasetfieldtype" table in 319c8d9 as part of pull request #5047 which was merged on Friday afternoon.
As of e948af2
scripts/database/upgrades/upgrade_v4.9.4_to_v4.10.sql
on the "develop" branch does not contain any SQL statements to add the new "uri" column so the definition of done for this issue is:We could expand the scope slightly to say that the dev guide should explain the procedure above. Perhaps "database migrations" deserves its own page? We should probably also mention the need to write SQL update scripts and let others know about them in http://guides.dataverse.org/en/4.9.4/developers/version-control.html#how-to-make-a-pull-request