#[ ZACATEK SOUBORU ]#

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

#[ CREATE TABLE ZACATEK ]#
    id_limit integer NOT NULL DEFAULT 0,
    id_den SERIAL,
    datum date NOT NULL DEFAULT ('now'::text)::date,
    c_data smallint NOT NULL DEFAULT 1,
    c_mena smallint NOT NULL DEFAULT 1,
    CONSTRAINT nlimitdni_<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='nlimitdni' and column_name='id_den_master') THEN
		ALTER TABLE <SCHEMA>.nlimitdni  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='nlimitdni' and column_name='id_sync') THEN
		ALTER TABLE <SCHEMA>.nlimitdni  ADD COLUMN id_sync integer NOT NULL DEFAULT 0;
	END IF;

END IF;

#[ KONEC SOUBORU ]#