Add many-to-many relationship InvestigationSample to the schema#240
Closed
EmilJunker wants to merge 4 commits intoicatproject:masterfrom
EmilJunker:schema-investigationsample
Closed
Add many-to-many relationship InvestigationSample to the schema#240EmilJunker wants to merge 4 commits intoicatproject:masterfrom EmilJunker:schema-investigationsample
EmilJunker wants to merge 4 commits intoicatproject:masterfrom
EmilJunker:schema-investigationsample
Conversation
Contributor
Author
|
I'm closing this PR in favor of #294. |
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 closes #231.
Here is a short 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 this is still very much a work in progress. A few points to note:
The upgrade script initializes the value of the
Sample.pidfield with 'local:<id>' (reusing theidattribute) for all samples where thepidis currentlyNULL. However, in the current ICAT schema, thepidfield has no unique constraint. This means that there could already be two samples with the samepid(at least theoretically). Or perhaps there could be several samples with thepidset to '' (an empty string). The upgrade script currently does not handle these cases (as they are very unlikely to occur in practice).The upgrade script also needs to move the existing one-to-many relationship between Investigation and Sample over to the new
InvestigationSampletable. 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.