1 |
8093
|
aaronmk
|
SELECT functions.to_global_col_names(:table_str);
|
2 |
|
|
|
3 |
8098
|
aaronmk
|
SELECT functions.rename_if_exists($$ALTER TABLE "TREE" RENAME "TREE.STATECD" TO ".STATECD" $$);
|
4 |
|
|
SELECT functions.rename_if_exists($$ALTER TABLE "TREE" RENAME "TREE.UNITCD" TO ".UNITCD" $$);
|
5 |
|
|
SELECT functions.rename_if_exists($$ALTER TABLE "TREE" RENAME "TREE.COUNTYCD" TO ".COUNTYCD"$$);
|
6 |
|
|
SELECT functions.rename_if_exists($$ALTER TABLE "TREE" RENAME "TREE.PLOT" TO ".PLOT" $$);
|
7 |
|
|
SELECT functions.rename_if_exists($$ALTER TABLE "TREE" RENAME "TREE.INVYR" TO ".INVYR" $$);
|
8 |
|
|
SELECT functions.rename_if_exists($$ALTER TABLE "TREE" RENAME "TREE.CONDID" TO ".CONDID" $$);
|
9 |
|
|
SELECT functions.rename_if_exists($$ALTER TABLE "TREE" RENAME "TREE.SUBP" TO ".SUBP" $$);
|
10 |
|
|
SELECT functions.rename_if_exists($$ALTER TABLE "TREE" RENAME "TREE.SPCD" TO ".SPCD" $$);
|
11 |
|
|
|
12 |
8110
|
aaronmk
|
SELECT functions.set_col_types(:table_str, ARRAY[
|
13 |
|
|
('.STATECD' , 'integer')
|
14 |
|
|
, ('.UNITCD' , 'integer')
|
15 |
|
|
, ('.COUNTYCD', 'integer')
|
16 |
|
|
, ('.PLOT' , 'integer')
|
17 |
|
|
, ('.INVYR' , 'integer')
|
18 |
|
|
, ('.SUBP' , 'integer')
|
19 |
|
|
, ('.CONDID' , 'integer')
|
20 |
|
|
, ('.SPCD' , 'integer')
|
21 |
|
|
]::functions.col_cast[]);
|
22 |
|
|
|
23 |
8128
|
aaronmk
|
-- ("STATECD", "UNITCD", "COUNTYCD", "PLOT", "INVYR", "CONDID", "SUBP", "TREE", "STATUSCD") is not ID
|
24 |
|
|
SELECT functions.create_if_not_exists($$ALTER TABLE "TREE" ADD CONSTRAINT "TREE.ID" UNIQUE ("TREE.CN")$$);
|
25 |
|
|
SELECT functions.cluster_once(:table_str, '"TREE.ID"');
|
26 |
8099
|
aaronmk
|
|
27 |
|
|
SELECT functions.create_if_not_exists($$CREATE INDEX "TREE.parent" ON "TREE" (".STATECD", ".UNITCD", ".COUNTYCD", ".PLOT", ".INVYR", ".CONDID", ".SUBP")$$);
|