Revision 6162
Added by Aaron Marcuse-Kubitza about 12 years ago
inputs/SALVIAS/salvias_plots.~.clean_up.sql | ||
---|---|---|
1 | 1 |
-- Ensure globally unique column names when tables are joined |
2 | 2 |
ALTER TABLE "lookup_MethodCode" RENAME "Description" TO "lookup_MethodCode_Description"; |
3 |
|
|
4 |
-- Enable cascading deletes |
|
5 |
|
|
6 |
CREATE INDEX ON "plotMetadata" (project_id); |
|
7 |
ALTER TABLE "plotMetadata" ADD FOREIGN KEY (project_id) REFERENCES projects(project_id) ON UPDATE CASCADE ON DELETE CASCADE; |
|
8 |
|
|
9 |
CREATE INDEX ON "plotObservations" ("PlotID"); |
|
10 |
ALTER TABLE "plotObservations" ADD FOREIGN KEY ("PlotID") REFERENCES "plotMetadata"("PlotID") ON UPDATE CASCADE ON DELETE CASCADE; |
|
11 |
|
|
12 |
CREATE INDEX ON stems ("PlotObsID"); |
|
13 |
ALTER TABLE stems ADD FOREIGN KEY ("PlotObsID") REFERENCES "plotObservations"("PlotObsID") ON UPDATE CASCADE ON DELETE CASCADE; |
Also available in: Unified diff
inputs/SALVIAS/salvias_plots.~.clean_up.sql: Enable cascading deletes by adding the necessary fkeys