#[ ZACATEK SOUBORU ]#

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

#[ CREATE TABLE ZACATEK ]#
    c_tr integer NOT NULL DEFAULT 0,
    tried integer NOT NULL DEFAULT 0,
    c_karty integer NOT NULL DEFAULT 0,
    c_data smallint NOT NULL DEFAULT 1,
    idriadok SERIAL,
    poradie integer NOT NULL DEFAULT 0,
    CONSTRAINT <TABLENAME>_<PRIMARYKEY> PRIMARY KEY (idriadok)
#[ CREATE TABLE KONEC ]#

#[ IF EXIST ZACATEK ]#
#[ PRIMARYKEY ]#
	IF NOT EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='ktried' and column_name='poradie') THEN
		ALTER TABLE <SCHEMA>.ktried ADD COLUMN poradie integer NOT NULL DEFAULT 0;
	END IF;
END IF;

#[ KONEC SOUBORU ]#