#[ ZACATEK SOUBORU ]#

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

#[ CREATE TABLE ZACATEK ]#

    id_kas character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    id_man character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    u_cis character(7) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    c_karty integer NOT NULL DEFAULT 0,
    nazev character(30) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    prachy numeric(12,2) NOT NULL DEFAULT 0,
    dan numeric(5,3) NOT NULL DEFAULT 0,
    mnozstvi numeric(10,3) NOT NULL DEFAULT 0,
    stor_mno numeric(10,3) NOT NULL DEFAULT 0,
    cen_hlad character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    k_odpoctu character(1) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    uzaverka character(17) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    blocked_by character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    selected character(1) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    u_time character(5) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    dotacia character(1) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    id_karty numeric NOT NULL DEFAULT 0,
    jc numeric(8,0) NOT NULL DEFAULT 0,
    id_fmenu character(7) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    procentosl numeric(2,0) NOT NULL DEFAULT 0,
    c_data integer NOT NULL DEFAULT 0,
    idriadok serial,
    typpolozky character(1) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    kompez 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='_tmskpol' and column_name='procentosl') THEN
		ALTER TABLE  <SCHEMA>._tmskpol ADD COLUMN procentosl numeric(2,0) NOT NULL DEFAULT 0;
	END IF;

	IF NOT EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='_tmskpol' and column_name='typpolozky') THEN
		ALTER TABLE <SCHEMA>._tmskpol ADD COLUMN typpolozky character(1) NOT NULL DEFAULT '';
	END IF;

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

END IF;

#[ KONEC SOUBORU ]#