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