Project

General

Profile

1 10084 aaronmk
SELECT util.search_path_append('util');
2 8163 aaronmk
3 8184 aaronmk
SELECT set_col_types('"TREE"', ARRAY[
4 10054 aaronmk
  ('*STATECD', 'integer')
5
, ('*UNITCD', 'integer')
6
, ('*COUNTYCD', 'integer')
7 8172 aaronmk
, ('locationName', 'integer')
8 10054 aaronmk
, ('*INVYR', 'integer')
9 8172 aaronmk
, ('subplot', 'integer')
10
, ('authorEventCode', 'integer')
11 10054 aaronmk
, ('*SPCD', 'integer')
12 8184 aaronmk
]::col_cast[]);
13 8110 aaronmk
14 10054 aaronmk
-- ("*STATECD", "*UNITCD", "*COUNTYCD", "locationName", "*INVYR", "authorEventCode", "subplot", "*TREE", "*STATUSCD") is not ID
15 8184 aaronmk
SELECT create_if_not_exists($$ALTER TABLE "TREE" ADD CONSTRAINT "TREE.ID" UNIQUE ("individualObservationID")$$);
16 8099 aaronmk
17 10054 aaronmk
SELECT create_if_not_exists($$CREATE INDEX "TREE.parent" ON "TREE" ("*STATECD", "*UNITCD", "*COUNTYCD", "locationName", "*INVYR", "authorEventCode", "subplot")$$);
18 8219 aaronmk
SELECT cluster_once('"TREE"', '"TREE.parent"');