#[ ZACATEK SOUBORU ]#

#DEF <SCHEMA>    food600
#DEF <PRIMARYKEY> idriadok
#DEF <TABLENAME> hh_hlav

#[ CREATE TABLE ZACATEK ]#
    c_kasy integer DEFAULT 0,
    aktivna smallint DEFAULT 0,
    zmazana smallint DEFAULT 0,
    meno character(30) COLLATE pg_catalog."default",
    den1 smallint DEFAULT 0,
    den2 smallint DEFAULT 0,
    den3 smallint DEFAULT 0,
    den4 smallint DEFAULT 0,
    den5 smallint DEFAULT 0,
    den6 smallint DEFAULT 0,
    den7 smallint DEFAULT 0,
    mes01 smallint DEFAULT 0,
    mes02 smallint DEFAULT 0,
    mes03 smallint DEFAULT 0,
    mes04 smallint DEFAULT 0,
    mes05 smallint DEFAULT 0,
    mes06 smallint DEFAULT 0,
    mes07 smallint DEFAULT 0,
    mes08 smallint DEFAULT 0,
    mes09 smallint DEFAULT 0,
    mes10 smallint DEFAULT 0,
    mes11 smallint DEFAULT 0,
    mes12 smallint DEFAULT 0,
    casod character(5) COLLATE pg_catalog."default" DEFAULT '""'::bpchar,
    casdo character(5) COLLATE pg_catalog."default" DEFAULT '""'::bpchar,
    datumod date,
    datumdo date,
    c_data smallint NOT NULL DEFAULT 1,
    typ_zlavy smallint DEFAULT 1,
    zl_koef numeric(20,10) DEFAULT (0),
    zl_cen_hl smallint DEFAULT 1,
    vs_druhy smallint DEFAULT 1,
    dat_cas_zm timestamp without time zone,
    autor character(3) COLLATE pg_catalog."default",
    idriadok SERIAL,
    mnoz_x integer NOT NULL DEFAULT 0,
    mnoz_k integer NOT NULL DEFAULT 0,
    CONSTRAINT <TABLENAME>_<PRIMARYKEY> PRIMARY KEY (idriadok)
#[ CREATE TABLE KONEC ]#

#[ IF EXIST ZACATEK ]#
#[ PRIMARYKEY ]#
	IF NOT EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='hh_hlav' and column_name='mnoz_x') THEN
		ALTER TABLE <SCHEMA>.hh_hlav  ADD COLUMN mnoz_x INTEGER NOT NULL DEFAULT 0;
	END IF;

	IF NOT EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='hh_hlav' and column_name='mnoz_k') THEN
		ALTER TABLE <SCHEMA>.hh_hlav  ADD COLUMN mnoz_k INTEGER NOT NULL DEFAULT 0;
	END IF;

END IF;


#[ KONEC SOUBORU ]#