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('"PLOT"');
8

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

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

Also available in: Unified diff