Project

General

Profile

« Previous | Next » 

Revision 6167

inputs/SALVIAS/: Updated to new salvias_plots export on nimoy, which has a different schema

View differences:

salvias_plots.~.clean_up.sql
1
-- Restore original table names
2
DROP TABLE "plotMetadata"; -- name conflicts with PlotMetadata and has less data
3
ALTER TABLE "PlotMetadata" RENAME TO "plotMetadata";
4
ALTER TABLE "PlotObservations" RENAME TO "plotObservations";
5

  
6
-- Delete rows that do not satisfy foreign key constraints
7
DELETE FROM stems WHERE "PlotObsID" IN (
8
    SELECT stems."PlotObsID"
9
    FROM stems
10
    LEFT JOIN "plotObservations" ON "plotObservations"."PlotObsID" = stems."PlotObsID"
11
    WHERE "plotObservations"."PlotObsID" IS NULL
12
);
13

  
1 14
-- Enable cascading deletes
2 15

  
3 16
CREATE INDEX ON "plotMetadata" (project_id);

Also available in: Unified diff