#[ ZACATEK SOUBORU ]#

#DEF <SCHEMA>    food600
#DEF <PRIMARYKEY> idriadok
#DEF <TABLENAME> vahinv

#[ CREATE TABLE ZACATEK ]#
    id_kas character(2) COLLATE pg_catalog."default",
    id_man character(2) COLLATE pg_catalog."default",
    c_stredisk integer,
    nazev character(30) COLLATE pg_catalog."default",
    uzaverka character(12) COLLATE pg_catalog."default",
    pocatek numeric,
    konec numeric,
    dotace numeric,
    spotreba numeric,
    c_data smallint NOT NULL DEFAULT 1,
    idriadok SERIAL,
    CONSTRAINT <TABLENAME>_<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='vahinv' and column_name='vsql') THEN
		ALTER TABLE <SCHEMA>.vahinv ADD COLUMN vsql smallint;
	END IF;
END IF;

#[ KONEC SOUBORU ]#