SELECT util.search_path_append('util');

SELECT set_col_types('"PLOT"', ARRAY[
  ('*STATECD', 'integer')
, ('*UNITCD', 'integer')
, ('*COUNTYCD', 'integer')
, ('locationName', 'integer')
, ('*INVYR', 'integer')
]::col_cast[]);

SELECT create_if_not_exists($$ALTER TABLE "PLOT" ADD CONSTRAINT "PLOT.ID"     UNIQUE ("locationID")$$);
SELECT create_if_not_exists($$ALTER TABLE "PLOT" ADD CONSTRAINT "PLOT.unique" UNIQUE ("*STATECD", "*UNITCD", "*COUNTYCD", "locationName", "*INVYR")$$);
SELECT cluster_once('"PLOT"', '"PLOT.unique"');
