-
Notifications
You must be signed in to change notification settings - Fork 54
Modify ReducedDatum constraints to no longer require nulls_distinct=False #1676
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0644edf
Add test that explicitly tests nulls_distinct=False
Fingel 9b2e308
Revert "Silence warning about unique constraints and null"
Fingel ba1efdf
Add system check warning to default_settings
Fingel 6ba1123
Add test for bulk creation with nulld_distinct=False
Fingel cee4f07
Be explicit about the null field being set
Fingel cfcc6f3
Remove nulls_district=False, use multiple constraits for PhotometryRe…
Fingel b023522
No longer need to silence warnings out constraints
Fingel 570ff7a
Merge branch 'dev' into nulls-distinct-test
jchate6 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
42 changes: 42 additions & 0 deletions
42
tom_dataproducts/migrations/0020_remove_astrometryreduceddatum_unique_astrometry_and_more.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # Generated by Django 5.2.13 on 2026-09-23 22:19 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('tom_dataproducts', '0019_alter_astrometryreduceddatum_options_and_more'), | ||
| ('tom_targets', '0031_basetarget_shared_by_basetarget_shared_from'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.RemoveConstraint( | ||
| model_name='astrometryreduceddatum', | ||
| name='unique_astrometry', | ||
| ), | ||
| migrations.RemoveConstraint( | ||
| model_name='photometryreduceddatum', | ||
| name='unique_photometry', | ||
| ), | ||
| migrations.RemoveConstraint( | ||
| model_name='spectroscopyreduceddatum', | ||
| name='unique_spectroscopy', | ||
| ), | ||
| migrations.AddConstraint( | ||
| model_name='astrometryreduceddatum', | ||
| constraint=models.UniqueConstraint(fields=('target', 'timestamp', 'telescope', 'instrument', 'ra', 'dec', 'reduction_version'), name='unique_astrometry'), | ||
| ), | ||
| migrations.AddConstraint( | ||
| model_name='photometryreduceddatum', | ||
| constraint=models.UniqueConstraint(fields=('target', 'bandpass', 'timestamp', 'brightness', 'instrument', 'reduction_version'), name='unique_photometry_brightness'), | ||
| ), | ||
| migrations.AddConstraint( | ||
| model_name='photometryreduceddatum', | ||
| constraint=models.UniqueConstraint(fields=('target', 'bandpass', 'timestamp', 'limit', 'instrument', 'reduction_version'), name='unique_photometry_limit'), | ||
| ), | ||
| migrations.AddConstraint( | ||
| model_name='spectroscopyreduceddatum', | ||
| constraint=models.UniqueConstraint(fields=('target', 'timestamp', 'telescope', 'instrument', 'flux', 'reduction_version'), name='unique_spectroscopy'), | ||
| ), | ||
| ] |
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
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
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
Oops, something went wrong.
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.
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.
Would this handle the situation where we have two photometry points with different brightnesses but the same limit? Whenever a limiting magnitude is available, we have been storing that in our database, even if the photometry point is a detection (i.e., it has a brightness). I think we would want two PhotometryReducedDatums to be allowed as long as the brightness OR the limit (or both) were different.
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.
Speaking to @griffin-h I think we determined that this would not cause problems in realistic scenarios.