#[ ZACATEK SOUBORU ]#

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

#[ CREATE TABLE ZACATEK ]#
    c_karty integer NOT NULL DEFAULT (0)::integer,
    ean character(30) COLLATE pg_catalog."default" NOT NULL DEFAULT ' '::bpchar,
    popis character(50) COLLATE pg_catalog."default" NOT NULL DEFAULT ' '::bpchar,
    koef numeric(10,4) DEFAULT 1.0000,
    c_data smallint NOT NULL DEFAULT 1,
    idriadok SERIAL,
    objem numeric(10,4) NOT NULL DEFAULT 1,
    CONSTRAINT eany_idriadok 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='eany' and column_name='kod') THEN
		ALTER TABLE <SCHEMA>.eany ADD COLUMN kod character(25) NOT NULL DEFAULT '';
	END IF;

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

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

END IF;
#[ KONEC SOUBORU ]#