1 |
8136
|
aaronmk
|
SELECT functions.to_global_col_names('"COND"');
|
2 |
8093
|
aaronmk
|
|
3 |
8122
|
aaronmk
|
SELECT functions.rename_if_exists($$ALTER TABLE "COND" RENAME "COND.STATECD" TO ".STATECD" $$);
|
4 |
|
|
SELECT functions.rename_if_exists($$ALTER TABLE "COND" RENAME "COND.UNITCD" TO ".UNITCD" $$);
|
5 |
|
|
SELECT functions.rename_if_exists($$ALTER TABLE "COND" RENAME "COND.COUNTYCD" TO ".COUNTYCD" $$);
|
6 |
|
|
SELECT functions.rename_if_exists($$ALTER TABLE "COND" RENAME "COND.PLOT" TO ".PLOT" $$);
|
7 |
|
|
SELECT functions.rename_if_exists($$ALTER TABLE "COND" RENAME "COND.INVYR" TO ".INVYR" $$);
|
8 |
|
|
SELECT functions.rename_if_exists($$ALTER TABLE "COND" RENAME "COND.CONDID" TO ".CONDID" $$);
|
9 |
|
|
SELECT functions.rename_if_exists($$ALTER TABLE "COND" RENAME "COND.HABTYPCD1" TO ".HABTYPCD" $$);
|
10 |
|
|
SELECT functions.rename_if_exists($$ALTER TABLE "COND" RENAME "COND.HABTYPCD1_PUB_CD" TO ".HABTYP_PUB_CD"$$);
|
11 |
8098
|
aaronmk
|
|
12 |
8136
|
aaronmk
|
SELECT functions.set_col_types('"COND"', ARRAY[
|
13 |
8110
|
aaronmk
|
('.STATECD' , 'integer')
|
14 |
|
|
, ('.UNITCD' , 'integer')
|
15 |
|
|
, ('.COUNTYCD', 'integer')
|
16 |
|
|
, ('.PLOT' , 'integer')
|
17 |
|
|
, ('.INVYR' , 'integer')
|
18 |
|
|
, ('.CONDID' , 'integer')
|
19 |
|
|
]::functions.col_cast[]);
|
20 |
|
|
|
21 |
8100
|
aaronmk
|
SELECT functions.create_if_not_exists($$
|
22 |
8101
|
aaronmk
|
ALTER TABLE "COND" ADD COLUMN "COND.oldgrowth" boolean;
|
23 |
|
|
ALTER TABLE "COND" ALTER COLUMN "COND.oldgrowth" TYPE boolean USING
|
24 |
8100
|
aaronmk
|
(
|
25 |
|
|
"COND.STDAGE"::integer>80
|
26 |
|
|
AND ("COND.TRTCD1"='0' OR "COND.TRTCD1" IS NULL)
|
27 |
|
|
AND (("COND.DSTRBCD1"<>'30' AND "COND.DSTRBCD1"<>'31' AND "COND.DSTRBCD1"<>'32' AND "COND.DSTRBCD1"<>'80') OR "COND.DSTRBCD1" IS NULL)
|
28 |
|
|
AND ("COND.STUMP_CD_PNWRS"='N' OR "COND.STUMP_CD_PNWRS" IS NULL)
|
29 |
|
|
AND "COND.HARVEST_TYPE1_SRS" IS NULL
|
30 |
|
|
AND "COND.PRESNFCD" IS NULL
|
31 |
|
|
AND ("COND.STDORGCD"='0' OR "COND.STDORGCD" IS NULL)
|
32 |
|
|
)
|
33 |
|
|
OR "COND.STND_COND_CD_PNWRS"='7'
|
34 |
|
|
;
|
35 |
|
|
$$);
|
36 |
|
|
|
37 |
8130
|
aaronmk
|
SELECT functions.create_if_not_exists($$ALTER TABLE "COND" ADD CONSTRAINT "COND.ID" UNIQUE ("COND.CN") $$);
|
38 |
8098
|
aaronmk
|
SELECT functions.create_if_not_exists($$ALTER TABLE "COND" ADD CONSTRAINT "COND.unique" UNIQUE (".STATECD", ".UNITCD", ".COUNTYCD", ".PLOT", ".INVYR", ".CONDID")$$);
|
39 |
8136
|
aaronmk
|
SELECT functions.cluster_once('"COND"', '"COND.unique"');
|