#[ ZACATEK SOUBORU ]#

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

#[ CREATE TABLE ZACATEK ]#
	data character(10) COLLATE pg_catalog."default" NOT NULL,
	cas timestamp without time zone DEFAULT now(),
	idriadok SERIAL,
	CONSTRAINT <TABLENAME>_<PRIMARYKEY> PRIMARY KEY (<PRIMARYKEY>)

#[ CREATE TABLE KONEC ]#

#[ IF EXIST ZACATEK ]#

	ALTER TABLE <SCHEMA>.<TABLENAME> ALTER COLUMN cas SET DEFAULT now();
	BEGIN
		UPDATE <SCHEMA>.<TABLENAME> SET cas=now();
		EXCEPTION
	        WHEN NO_DATA_FOUND THEN
       		INSERT INTO <SCHEMA>.<TABLENAME> (data) VALUES ('1111-11-11');
	END;
 END IF;
#[ KONEC SOUBORU ]#

