#[ ZACATEK SOUBORU ]#

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

#[ CREATE TABLE ZACATEK ]#
    typ character(1) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    raster_id integer NOT NULL DEFAULT 0,
    cena_celk numeric(20,10) NOT NULL DEFAULT 0,
    id_meny integer NOT NULL DEFAULT 0,
    datum date,
    cas character(8) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    doklad character(30) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    cena numeric(20,10) NOT NULL DEFAULT 0,
    pocet integer NOT NULL DEFAULT 0,
    id_rodic integer NOT NULL DEFAULT 0,
    id_pol integer NOT NULL DEFAULT 0,
    c_karty integer NOT NULL DEFAULT 0,
    id_platba integer NOT NULL DEFAULT 0,
    id_man character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    pr numeric(5,3) NOT NULL DEFAULT 1,
    id_hotel integer NOT NULL DEFAULT 0,
    c_data integer NOT NULL DEFAULT 1,
    idriadok SERIAL,
    id integer NOT NULL DEFAULT 0,
    c_uzav integer NOT NULL DEFAULT 0,
    CONSTRAINT pr_hores10_idriadok 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='pr_hores10' and column_name='cena' and data_type='double precision') THEN
		ALTER TABLE <SCHEMA>.pr_hores10  ALTER COLUMN cena TYPE numeric(20, 10);
		ALTER TABLE <SCHEMA>.pr_hores10  ALTER COLUMN cena SET DEFAULT 0;
	END IF;

	IF EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='pr_hores10' and column_name='cena_celk' and data_type='double precision') THEN
		ALTER TABLE <SCHEMA>.pr_hores10  ALTER COLUMN cena_celk TYPE numeric(20, 10);
		ALTER TABLE <SCHEMA>.pr_hores10  ALTER COLUMN cena_celk SET DEFAULT 0;
	END IF;

END IF;

#[ KONEC SOUBORU ]#