BEGIN;
  ALTER TABLE IF EXISTS "ref_instances" 
    ADD COLUMN "port_r66" integer not null default 6666,
    ADD COLUMN "port_r66_ssl" integer not null default 667,
    ADD COLUMN "port_r66_monitoring" integer not null default 8066,
    ADD COLUMN "port_r66_admin" integer not null default 8067,
    ADD COLUMN "port_r66_rest" integer not null default 8088,
    ADD COLUMN "port_gwftp" integer not null default 6621,
    ADD COLUMN "port_gwftp_monitoring" integer not null default 8068,
    ADD COLUMN "port_gwftp_admin" integer not null default 8069,
    ADD COLUMN "port_gwftp_passive_min" integer not null default 30000,
    ADD COLUMN "port_gwftp_passive_max" integer not null default 40000
    ;

  CREATE TABLE IF NOT EXISTS "ref_instances" (
    "app_name" text not null,
    "id_app" text not null,
    "env" text not null,
    "tiers_id" text unique not null,
    "tiers_id_ssl" text unique not null,
    "host_name" text not null,
    "ip_address" text not null,
    "site_name" text not null,
    "type" text not null,
    "port_r66" integer not null default 6666,
    "port_r66_ssl" integer not null default 667,
    "port_r66_monitoring" integer not null default 8066,
    "port_r66_admin" integer not null default 8067,
    "port_r66_rest" integer not null default 8088,
    "port_gwftp" integer not null default 6621,
    "port_gwftp_monitoring" integer not null default 8068,
    "port_gwftp_admin" integer not null default 8069,
    "port_gwftp_passive_min" integer not null default 30000,
    "port_gwftp_passive_max" integer not null default 40000
   );
COMMIT;