#[ ZACATEK SOUBORU ]#

#DEF <SCHEMA>    food600
#DEF <PRIMARYKEY> id_stat
#DEF <TABLENAME> nlimitstatus

#[ CREATE TABLE ZACATEK ]#
    id_stat SERIAL,
    status character(30) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    zmazane smallint NOT NULL DEFAULT 0,
    c_data smallint NOT NULL DEFAULT 1,
    start smallint NOT NULL DEFAULT 0,
    koniec smallint NOT NULL DEFAULT 0,
    stat_eshop smallint NOT NULL DEFAULT 0,
    farba integer NOT NULL DEFAULT 16777215,
    CONSTRAINT nlimitstatus_<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='nlimitstatus' and column_name='stat_eshop') THEN
		ALTER TABLE <SCHEMA>.nlimitstatus ADD COLUMN stat_eshop smallint NOT NULL DEFAULT 0;
	END IF;

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

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

END IF;

#[ KONEC SOUBORU ]#