#[ ZACATEK SOUBORU ]#

#DEF <SCHEMA>    food600
#DEF <PRIMARYKEY> postseqnr
#DEF <TABLENAME> db_out

#[ CREATE TABLE ZACATEK ]#
    typ character(5) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    stav character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    postseqnr SERIAL,
    cis_kasy character(5) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    outlet character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    porad_tiz character(4) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    pokoj character(8) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    datum date,
    sekund numeric(10,3) NOT NULL DEFAULT 0,
    dat character(6) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    cas character(6) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    ucet_kasa character(7) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    serv_per character(1) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    folio character(10) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    gn character(40) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    p_hostu character(5) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    total numeric(15,2) NOT NULL DEFAULT 0,
    s1 numeric(15,2) NOT NULL DEFAULT 0,
    d1 numeric(15,2) NOT NULL DEFAULT 0,
    t1 numeric(15,2) NOT NULL DEFAULT 0,
    s2 numeric(15,2) NOT NULL DEFAULT 0,
    d2 numeric(15,2) NOT NULL DEFAULT 0,
    t2 numeric(15,2) NOT NULL DEFAULT 0,
    s3 numeric(15,2) NOT NULL DEFAULT 0,
    d3 numeric(15,2) NOT NULL DEFAULT 0,
    t3 numeric(15,2) NOT NULL DEFAULT 0,
    s4 numeric(15,2) NOT NULL DEFAULT 0,
    d4 numeric(15,2) NOT NULL DEFAULT 0,
    t4 numeric(15,2) NOT NULL DEFAULT 0,
    s5 numeric(15,2) NOT NULL DEFAULT 0,
    d5 numeric(15,2) NOT NULL DEFAULT 0,
    t5 numeric(15,2) NOT NULL DEFAULT 0,
    s6 numeric(15,2) NOT NULL DEFAULT 0,
    d6 numeric(15,2) NOT NULL DEFAULT 0,
    t6 numeric(15,2) NOT NULL DEFAULT 0,
    s7 numeric(15,2) NOT NULL DEFAULT 0,
    d7 numeric(15,2) NOT NULL DEFAULT 0,
    t7 numeric(15,2) NOT NULL DEFAULT 0,
    s8 numeric(15,2) NOT NULL DEFAULT 0,
    d8 numeric(15,2) NOT NULL DEFAULT 0,
    t8 numeric(15,2) NOT NULL DEFAULT 0,
    s9 numeric(15,2) NOT NULL DEFAULT 0,
    d9 numeric(15,2) NOT NULL DEFAULT 0,
    t9 numeric(15,2) NOT NULL DEFAULT 0,
    dysko numeric(15,2) NOT NULL DEFAULT 0,
    pm character(5) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    ckar character(30) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    track2 character(30) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    retrans numeric(1,0) NOT NULL DEFAULT 0,
    CONSTRAINT db_out_pkey PRIMARY KEY (postseqnr)
#[ CREATE TABLE KONEC ]#

#[ IF EXIST ZACATEK ]#
#[ PRIMARYKEY ]#


	IF EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='db_out' and column_name='gn') THEN
		ALTER TABLE <SCHEMA>.db_out ALTER COLUMN gn TYPE bpchar(60) USING gn::bpchar;
	END IF;

END IF;

#[ KONEC SOUBORU ]#