[OBSPROC-38] add a unique constraint of (proposal_id, ob_code) in the target table Created: 20/Apr/23 Updated: 20/Apr/23 Resolved: 20/Apr/23 |
|
| Status: | Done |
| Project: | PFS observation processing/procedure |
| Component/s: | ets_target_database |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Normal |
| Reporter: | monodera | Assignee: | monodera |
| Resolution: | Done | Votes: | 0 |
| Labels: | targetDB | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Epic Link: | targetDB |
| Reviewers: | monodera |
| Description |
|
(proposal_id, ob_code) pair must be unique to track the progress. It will need to be implemented in the target table of targetdb. |
| Comments |
| Comment by monodera [ 20/Apr/23 ] |
|
I modified code and tried to update the schema with alembic. The update script returned errors by detecting duplicates for the unique constraint. It seems some objects have been inserted twice.
Perhaps, it will be safe to delete one of duplicated rows, but wait for a bit. |
| Comment by monodera [ 20/Apr/23 ] |
|
Using the following queries, I deleted one of two entries of duplicates. Then the alembic update succeeded.
|
| Comment by monodera [ 20/Apr/23 ] |
|
The database column was updated. |