#[ ZACATEK SOUBORU ]#

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

#[ CREATE TABLE ZACATEK ]#
    datum date,
    id_strav integer NOT NULL DEFAULT 0,
    pocet integer NOT NULL DEFAULT 0,
    suma numeric(20,10) NOT NULL DEFAULT 0,
    oscislo character varying(20) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::character varying,
    stredisko character varying(30) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::character varying,
    md character varying(10) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::character varying,
    dal character varying(10) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::character varying,
    dph_dal character varying(10) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::character varying,
    dph numeric(5,2) NOT NULL DEFAULT 1,
    idriadok SERIAL,
    CONSTRAINT <TABLENAME>_<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='uexarchstrava' and column_name='suma' and data_type='double precision') THEN
		ALTER TABLE <SCHEMA>.uexarchstrava  ALTER COLUMN suma TYPE numeric(20, 10);
		ALTER TABLE <SCHEMA>.uexarchstrava  ALTER COLUMN suma SET DEFAULT 0;
	END IF;
END IF;

#[ KONEC SOUBORU ]#