SELECT functions.to_global_col_names(:table_str); SELECT functions.rename_if_exists($$ALTER TABLE "COUNTY" RENAME "COUNTY.STATECD" TO ".STATECD" $$); SELECT functions.rename_if_exists($$ALTER TABLE "COUNTY" RENAME "COUNTY.UNITCD" TO ".UNITCD" $$); SELECT functions.rename_if_exists($$ALTER TABLE "COUNTY" RENAME "COUNTY.COUNTYCD" TO ".COUNTYCD"$$); SELECT functions.set_col_types(:table_str, ARRAY[ ('.STATECD' , 'integer') , ('.UNITCD' , 'integer') , ('.COUNTYCD', 'integer') ]::functions.col_cast[]); SELECT functions.create_if_not_exists($$ALTER TABLE "COUNTY" ADD CONSTRAINT "COUNTY.unique" UNIQUE (".STATECD", ".UNITCD", ".COUNTYCD")$$);