Revision 8098
Added by Aaron Marcuse-Kubitza almost 12 years ago
inputs/FIA/PLOT/postprocess.sql | ||
---|---|---|
1 | 1 |
SELECT functions.to_global_col_names(:table_str); |
2 | 2 |
|
3 |
SELECT functions.create_if_not_exists($$ALTER TABLE "PLOT" ADD CONSTRAINT "PLOT.unique" UNIQUE ("PLOT.STATECD", "PLOT.UNITCD", "PLOT.COUNTYCD", "PLOT.PLOT", "PLOT.INVYR")$$); |
|
3 |
SELECT functions.rename_if_exists($$ALTER TABLE "PLOT" RENAME "PLOT.STATECD" TO ".STATECD" $$); |
|
4 |
SELECT functions.rename_if_exists($$ALTER TABLE "PLOT" RENAME "PLOT.UNITCD" TO ".UNITCD" $$); |
|
5 |
SELECT functions.rename_if_exists($$ALTER TABLE "PLOT" RENAME "PLOT.COUNTYCD" TO ".COUNTYCD"$$); |
|
6 |
SELECT functions.rename_if_exists($$ALTER TABLE "PLOT" RENAME "PLOT.PLOT" TO ".PLOT" $$); |
|
7 |
SELECT functions.rename_if_exists($$ALTER TABLE "PLOT" RENAME "PLOT.INVYR" TO ".INVYR" $$); |
|
8 |
|
|
9 |
SELECT functions.create_if_not_exists($$ALTER TABLE "PLOT" ADD CONSTRAINT "PLOT.unique" UNIQUE (".STATECD", ".UNITCD", ".COUNTYCD", ".PLOT", ".INVYR")$$); |
inputs/FIA/COND/postprocess.sql | ||
---|---|---|
1 | 1 |
SELECT functions.to_global_col_names(:table_str); |
2 | 2 |
|
3 |
SELECT functions.create_if_not_exists($$ALTER TABLE "COND" ADD CONSTRAINT "COND.unique" UNIQUE ("COND.STATECD", "COND.UNITCD", "COND.COUNTYCD", "COND.PLOT", "COND.INVYR", "COND.CONDID")$$); |
|
3 |
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 |
|
|
10 |
SELECT functions.create_if_not_exists($$ALTER TABLE "COND" ADD CONSTRAINT "COND.unique" UNIQUE (".STATECD", ".UNITCD", ".COUNTYCD", ".PLOT", ".INVYR", ".CONDID")$$); |
inputs/FIA/REF_SPECIES/postprocess.sql | ||
---|---|---|
1 | 1 |
SELECT functions.to_global_col_names(:table_str); |
2 | 2 |
|
3 |
SELECT functions.create_if_not_exists($$ALTER TABLE "REF_SPECIES" ADD CONSTRAINT "REF_SPECIES.unique" UNIQUE ("REF_SPECIES.SPCD")$$); |
|
3 |
SELECT functions.rename_if_exists($$ALTER TABLE "REF_SPECIES" RENAME "REF_SPECIES.SPCD" TO ".SPCD"$$); |
|
4 |
|
|
5 |
SELECT functions.create_if_not_exists($$ALTER TABLE "REF_SPECIES" ADD CONSTRAINT "REF_SPECIES.unique" UNIQUE (".SPCD")$$); |
inputs/FIA/TREE/postprocess.sql | ||
---|---|---|
1 | 1 |
SELECT functions.to_global_col_names(:table_str); |
2 | 2 |
|
3 |
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 |
|
|
3 | 12 |
-- ("STATECD", "UNITCD", "COUNTYCD", "PLOT", "INVYR", "CONDID", "SUBP", "TREE", "STATUSCD") is not unique |
4 | 13 |
SELECT functions.create_if_not_exists($$ALTER TABLE "TREE" ADD CONSTRAINT "TREE.unique" UNIQUE ("TREE.CN")$$); |
inputs/FIA/SUBPLOT/postprocess.sql | ||
---|---|---|
1 | 1 |
SELECT functions.to_global_col_names(:table_str); |
2 | 2 |
|
3 |
SELECT functions.create_if_not_exists($$ALTER TABLE "SUBPLOT" ADD CONSTRAINT "SUBPLOT.unique" UNIQUE ("SUBPLOT.STATECD", "SUBPLOT.UNITCD", "SUBPLOT.COUNTYCD", "SUBPLOT.PLOT", "SUBPLOT.INVYR", "SUBPLOT.SUBP")$$); |
|
3 |
SELECT functions.rename_if_exists($$ALTER TABLE "SUBPLOT" RENAME "SUBPLOT.STATECD" TO ".STATECD" $$); |
|
4 |
SELECT functions.rename_if_exists($$ALTER TABLE "SUBPLOT" RENAME "SUBPLOT.UNITCD" TO ".UNITCD" $$); |
|
5 |
SELECT functions.rename_if_exists($$ALTER TABLE "SUBPLOT" RENAME "SUBPLOT.COUNTYCD" TO ".COUNTYCD"$$); |
|
6 |
SELECT functions.rename_if_exists($$ALTER TABLE "SUBPLOT" RENAME "SUBPLOT.PLOT" TO ".PLOT" $$); |
|
7 |
SELECT functions.rename_if_exists($$ALTER TABLE "SUBPLOT" RENAME "SUBPLOT.INVYR" TO ".INVYR" $$); |
|
8 |
SELECT functions.rename_if_exists($$ALTER TABLE "SUBPLOT" RENAME "SUBPLOT.SUBP" TO ".SUBP" $$); |
|
9 |
|
|
10 |
SELECT functions.create_if_not_exists($$ALTER TABLE "SUBPLOT" ADD CONSTRAINT "SUBPLOT.unique" UNIQUE (".STATECD", ".UNITCD", ".COUNTYCD", ".PLOT", ".INVYR", ".SUBP")$$); |
Also available in: Unified diff
inputs/FIA/*/postprocess.sql: Removed table prefix from globally-unique columns that should be joined on