#[ ZACATEK SOUBORU ]#

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

#[ CREATE TABLE ZACATEK ]#
    kod character(7) COLLATE pg_catalog."default" DEFAULT ''::bpchar,
    c_karty integer NOT NULL DEFAULT 0,
    id_man character(2) COLLATE pg_catalog."default" DEFAULT ''::bpchar,
    id_kas character(2) COLLATE pg_catalog."default" DEFAULT ''::bpchar,
    cena numeric(20,10) DEFAULT 0,
    dan integer DEFAULT 0,
    c_data smallint NOT NULL DEFAULT 1,
    idriadok SERIAL,
    CONSTRAINT z_horca_<PRIMARYKEY> PRIMARY KEY (<PRIMARYKEY>)
#[ CREATE TABLE KONEC ]#

#[ IF EXIST ZACATEK ]#
#[ PRIMARYKEY ]#
	IF EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='z_horca' and column_name='cena' and data_type='double precision') THEN
		ALTER TABLE <SCHEMA>.z_horca  ALTER COLUMN cena TYPE numeric(20, 10);
		ALTER TABLE <SCHEMA>.z_horca  ALTER COLUMN cena SET DEFAULT 0;
	END IF;
END IF;

#[ KONEC SOUBORU ]#