root/inputs/FIA/COUNTY/import @ 8397
1 | 8163 | aaronmk | #!/bin/bash
|
---|---|---|---|
2 | # :mode=transact-sql:
|
||
3 | cd "$(dirname "$0")" |
||
4 | . ../../../lib/import.sh
|
||
5 | |||
6 | 8164 | aaronmk | map_table |
7 | 8163 | aaronmk | psql <<'EOF' |
8 | 8184 | aaronmk | SELECT set_col_types('"COUNTY"', ARRAY[
|
9 | 8172 | aaronmk | ('STATECD', 'integer')
|
10 | , ('UNITCD', 'integer')
|
||
11 | 8170 | aaronmk | , ('COUNTYCD', 'integer')
|
12 | 8184 | aaronmk | ]::col_cast[]);
|
13 | 8124 | aaronmk | |
14 | 8316 | aaronmk | SELECT create_if_not_exists($$ALTER TABLE "COUNTY" ADD CONSTRAINT "COUNTY.ID" UNIQUE ("COUNTY-CN")$$); |
15 | 8184 | aaronmk | SELECT create_if_not_exists($$ALTER TABLE "COUNTY" ADD CONSTRAINT "COUNTY.unique" UNIQUE ("STATECD", "UNITCD", "COUNTYCD")$$); |
16 | 8208 | aaronmk | EOF
|
17 | mk_derived |