New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
have OMERO server populate database with missing enumeration values #4837
Conversation
to be used at server startup as a kind of upsert for enum values
to be superseded by use of the enumeration ensuring bean
With this commit, the following statements are executed at the server startup (DB upgraded from 5.2__0`):
And importing a file with a The logic looks sensible and certainly reduces the need for DB ugprade scripts making minor schema releases with enumeration additions potentially achievable in patch releases without too much impact. Having looked quickly at the code, I did not spot anything that raised a red flag to me although it might be good to know if there is some departure with the original intent of NB: the For the next steps, I would suggest we move this PR (and the companion #4820) out of the breaking queue. Is it required that the corresponding Bio-Formats PR should be migrated as well or is there a test case for having the mappings added only at the OMERO level (in which case I would expect no enumeration addition to the DB and normal startup)? |
The companion formats are added on the basis of the reader's Happy to move OMERO PRs out of breaking; of course this will add the new values to the normal DB. I can't see why not to take the Bio-Formats one out too but am happy to wait. The bigger question with that one is the strategy of the version number increment cf. recent weeks' namespace discussion on https://trello.com/c/0zNp8HvU/167-enumerations-addition. |
@@ -513,7 +513,7 @@ implements java.io.Serializable, IObject | |||
* | |||
* will fail. Experimenter has no owner, for obvious reasons. | |||
* | |||
* Note: subclasses of this class will return a subclasse of | |||
* Note: subclasses of this class will return a subclass of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you get the typo fix out this PR?
since it is not related to this work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, force-pushed away and put into #4847
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
e63a447
to
a9b42c6
Compare
2 high-ish level thoughts:
|
|
I'm less worried about someone consuming the method than someone who has implemented
Is that the only diff you were seeing, @sbesson ? |
Ah, okay, can certainly add method back in then but deprecate. |
Thanks for the changes. The added values are:
which makes sense. 👍 |
Yes, it can. |
String name = formatReader.getClass().getSimpleName(); | ||
if (name.endsWith("Reader")) { | ||
name = name.substring(0, name.length() - 6); | ||
if ("Fake".equals(name)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should "FilePattern"(Reader) also be excluded?
What this PR does
When a new version of OMERO.server starts up (minor or major) it reviews the enumeration values defined in
<enum>
tags incomponents/model/resources/mappings/
and ensures that all those strings exist in the corresponding database tables.Testing this PR
In an older version of OMERO delete a few enumeration values from the database. Upgrade to and start up the latest version of OMERO with this PR included and see if those values are added back.
Additionally the
format
table should continue to be populated with new image formats as reported by Bio-Formats readers whenever a new version of Bio-Formats is detected so in the above testing maybe also delete a few formats too that you know should be there (beyond just those listed inacquisition.ome.xml
).Related reading
https://trello.com/c/0zNp8HvU/167-enumerations-addition