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