#[ ZACATEK SOUBORU ]#

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

#[ CREATE TABLE ZACATEK ]#
    var_name character(50) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    var_value character(250) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    modul character(12) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    setup_skup character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    idriadok SERIAL,
    CONSTRAINT <TABLENAME>_<PRIMARYKEY> PRIMARY KEY (idriadok)
#[ CREATE TABLE KONEC ]#


#[ IF EXIST ZACATEK ]#
#[ PRIMARYKEY ]#

	IF EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='defsubor' and column_name='var_value') THEN
		ALTER TABLE <SCHEMA>.defsubor   ALTER COLUMN var_value TYPE varchar(250);
	END IF;

       ALTER TABLE <SCHEMA>.defsubor  ALTER COLUMN var_name TYPE character (50) ;

END IF;

#[ KONEC SOUBORU ]#