-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
To prepare for the ability to redefine subzones that already contain monitoring plots, start recording which versions of plots were included in observations. This will allow us to tell the user which subzone a plot was in at the time of the observation, even if the site map has subsequently changed.
- Loading branch information
Showing
6 changed files
with
46 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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
16 changes: 16 additions & 0 deletions
16
src/main/resources/db/migration/0300/V319__ObservationPlotHistory.sql
This file contains 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,16 @@ | ||
-- Record which version of a plot was observed so we can link it to its correct subzone at the | ||
-- time of the observation. | ||
ALTER TABLE tracking.observation_plots | ||
ADD COLUMN monitoring_plot_history_id BIGINT | ||
REFERENCES tracking.monitoring_plot_histories ON DELETE CASCADE; | ||
CREATE INDEX ON tracking.observation_plots (monitoring_plot_history_id); | ||
|
||
UPDATE tracking.observation_plots op | ||
SET monitoring_plot_history_id = ( | ||
SELECT id | ||
FROM tracking.monitoring_plot_histories mph | ||
WHERE mph.monitoring_plot_id = op.monitoring_plot_id | ||
); | ||
|
||
ALTER TABLE tracking.observation_plots | ||
ALTER COLUMN monitoring_plot_history_id SET NOT NULL; |
This file contains 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 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 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 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