Project

General

Profile

« Previous | Next » 

Revision 8164

inputs/FIA/*/import: Use map_table to set column names based on the contents of map.csv, instead of using functions.to_global_col_names() and functions.rename_if_exists(). Added map.csv for all tables.

View differences:

import
3 3
cd "$(dirname "$0")"
4 4
. ../../../lib/import.sh
5 5

  
6
map_table
6 7
psql <<'EOF'
7
SELECT functions.to_global_col_names('"SUBPLOT"');
8

  
9
SELECT functions.rename_if_exists($$ALTER TABLE "SUBPLOT" RENAME "SUBPLOT.STATECD"  TO ".STATECD" $$);
10
SELECT functions.rename_if_exists($$ALTER TABLE "SUBPLOT" RENAME "SUBPLOT.UNITCD"   TO ".UNITCD"  $$);
11
SELECT functions.rename_if_exists($$ALTER TABLE "SUBPLOT" RENAME "SUBPLOT.COUNTYCD" TO ".COUNTYCD"$$);
12
SELECT functions.rename_if_exists($$ALTER TABLE "SUBPLOT" RENAME "SUBPLOT.PLOT"     TO ".PLOT"    $$);
13
SELECT functions.rename_if_exists($$ALTER TABLE "SUBPLOT" RENAME "SUBPLOT.INVYR"    TO ".INVYR"   $$);
14
SELECT functions.rename_if_exists($$ALTER TABLE "SUBPLOT" RENAME "SUBPLOT.SUBP"     TO ".SUBP"    $$);
15

  
16 8
SELECT functions.set_col_types('"SUBPLOT"', ARRAY[
17 9
  ('.STATECD' , 'integer')
18 10
, ('.UNITCD'  , 'integer')

Also available in: Unified diff