#[ ZACATEK SOUBORU ]#

#DEF <SCHEMA>    food600
#DEF <PRIMARYKEY> id_chod
#DEF <TABLENAME> nlimitchody

#[ CREATE TABLE ZACATEK ]#
    id_chod SERIAL,
    chod character(50) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    chod1 character(50) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    chod2 character(50) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    chod3 character(50) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    zmazane smallint NOT NULL DEFAULT 0,
    c_data smallint NOT NULL DEFAULT 1,
    CONSTRAINT nlimitchody_<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='nlimitchody' and column_name='id_chod_master') THEN
		ALTER TABLE <SCHEMA>.nlimitchody  ADD COLUMN id_chod_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='nlimitchody' and column_name='id_sync') THEN
		ALTER TABLE <SCHEMA>.nlimitchody  ADD COLUMN id_sync integer NOT NULL DEFAULT 0;
	END IF;

	IF not EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='nlimitchody' and column_name='casod') THEN
		ALTER TABLE IF EXISTS <SCHEMA>.nlimitchody  ADD COLUMN casod character(6) NOT NULL DEFAULT '00:00';
	END IF;

	IF not EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='nlimitchody' and column_name='casdo') THEN
		ALTER TABLE IF EXISTS <SCHEMA>.nlimitchody  ADD COLUMN casdo character(6) NOT NULL DEFAULT '24:00';
	END IF;

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

END IF;

#[ KONEC SOUBORU ]#