#[ ZACATEK SOUBORU ]#

#DEF <SCHEMA>    food600
#DEF <PRIMARYKEY> id_skup
#DEF <TABLENAME> spravyskupiny

#[ CREATE TABLE ZACATEK ]#
    id_skup SERIAL,
    skupina character varying(40) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::character varying,
    c_data smallint NOT NULL DEFAULT 1,
    zmena timestamp without time zone NOT NULL DEFAULT now(),
    CONSTRAINT spravyskupiny_<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='spravyskupiny' and column_name='zmena') THEN
		ALTER TABLE <SCHEMA>.spravyskupiny  ADD COLUMN zmena timestamp without time zone NOT NULL DEFAULT now();
	END IF;

	IF NOT EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='spravyskupiny' and column_name='id_skup_master') THEN
		ALTER TABLE <SCHEMA>.spravyskupiny  ADD COLUMN id_skup_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='spravyskupiny' and column_name='id_sync') THEN
		ALTER TABLE <SCHEMA>.spravyskupiny  ADD COLUMN id_sync integer NOT NULL DEFAULT 0;
	END IF;

END IF;

#[ KONEC SOUBORU ]#