SELECT functions.to_global_col_names('"REF_SPECIES"');

SELECT functions.rename_if_exists($$ALTER TABLE "REF_SPECIES" RENAME "REF_SPECIES.SPCD"           TO ".SPCD"  $$);
SELECT functions.rename_if_exists($$ALTER TABLE "REF_SPECIES" RENAME "REF_SPECIES.SPECIES_SYMBOL" TO ".SYMBOL"$$);

SELECT functions.set_col_types('"REF_SPECIES"', ARRAY[
  ('.SPCD', 'integer')
]::functions.col_cast[]);

SELECT functions.create_if_not_exists($$ALTER TABLE "REF_SPECIES" ADD COLUMN ".SYMBOL_TYPE" text NOT NULL DEFAULT 'Species'$$);

SELECT functions.create_if_not_exists($$ALTER TABLE "REF_SPECIES" ADD CONSTRAINT "REF_SPECIES.unique" UNIQUE (".SPCD")$$);
