#[ ZACATEK SOUBORU ]#

#DEF <SCHEMA>    food600
#DEF <PRIMARYKEY> id_den
#DEF <TABLENAME> nlimitsablonydni

#[ CREATE TABLE ZACATEK ]#
    id_limit integer NOT NULL DEFAULT 0,
    cyklus integer NOT NULL DEFAULT 1,
    den integer NOT NULL DEFAULT 1,
    id_den SERIAL,
    c_data smallint NOT NULL DEFAULT 1,
    id_chod integer NOT NULL DEFAULT 0,
    limit1 numeric(20,10) NOT NULL DEFAULT 0,
    limit2 numeric(20,10) NOT NULL DEFAULT 0,
    pocet1 numeric(5,0) NOT NULL DEFAULT 0,
    pocet2 numeric(5,0) NOT NULL DEFAULT 0,
    poznamka character varying(250) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::character varying,
    pozn_int character varying(250) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::character varying,
    CONSTRAINT nlimitsablonydni_<PRIMARYKEY> PRIMARY KEY (<PRIMARYKEY>)
#[ CREATE TABLE KONEC ]#

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

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

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

END IF;

#[ KONEC SOUBORU ]#