Add many-to-many relationship InvestigationSample to the schema#294
Draft
EmilJunker wants to merge 10 commits intomasterfrom
Draft
Add many-to-many relationship InvestigationSample to the schema#294EmilJunker wants to merge 10 commits intomasterfrom
EmilJunker wants to merge 10 commits intomasterfrom
Conversation
the relationship from Investigation to Sample. This is currently broken and need to be reviewed.
- set CREATE_ID and MOD_ID to the constant value 'schema_upgrade', - also set MOD_ID and MOD_TIME when setting a PID value in SAMPLE, - use prefix '_local' in the PID values set in SAMPLE. Still need to review the oracle upgrade script accordingly.
- set CREATE_ID and MOD_ID to the constant value 'schema_upgrade', - also set MOD_ID and MOD_TIME when setting a PID value in SAMPLE, - use prefix '_local' in the PID values set in SAMPLE.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This replaces the old pull request #240 and closes #231. It turns the one-to-many relationship between
InvestigationandSampleinto a many-to-many relationship. Consequently, it also changes the uniqueness constraint of theSampletable.I rebased the changes from #240 with the current master branch and resolved all occurring conflicts. I then pushed the branch to the official
icat.serverrepository instead of my forked version to make it easier for others to review and to make changes. That is also the reason why I opened this new pull request (GitHub doesn't allow to change the source branch of an existing pull request).Here is a summary of the changes:
InvestigationSampleto the schema(representing a many-to-many relationship between
InvestigationandSample).Sampletable frominvestigation, nameto justpid(adding a NOT NULL constraint for
pidwhile also keeping the existing NOT NULL constraint forname).Note that all the things I mentioned in #240 still apply to this pull request. Most notably, it is very much a work in progress.
Some notes about the upgrade script:
For all samples where the
pidfield is currentlyNULL, the upgrade script sets thepidto 'local:<id>' (reusing the internalidattribute). However, in the current ICAT schema, thepidfield has no unique constraint. This means that there could theoretically be two samples with the samepid. Or perhaps there could be several samples with thepidset to '' (an empty string). The upgrade script currently does not handle these cases.The upgrade script also transfers the existing one-to-many relationship between
InvestigationandSampleto the newInvestigationSampletable. Once this is done, the unique constraints on theSampletable are updated and theSample.investigation_idcolumn is dropped. I'm not sure if the current implementation of the upgrade script handles all of this correctly. In other words: thorough testing is needed.