#[ ZACATEK SOUBORU ]#

#DEF <SCHEMA>    food600
#DEF <PRIMARYKEY> idr
#DEF <TABLENAME> genstav

#[ CREATE TABLE ZACATEK ]#
    c_karty integer NOT NULL DEFAULT 0,
    c_dokl integer,
    zustatek numeric(20,10),
    cena_prum numeric(20,10),
    cena numeric(20,10),
    c_stredisk integer,
    c_mena smallint NOT NULL DEFAULT 1,
    operace character(2) COLLATE pg_catalog."default",
    poradi integer,
    mnozstvi numeric(20,10),
    min_zaso numeric(12,4),
    c_data smallint NOT NULL DEFAULT 1,
    menostlp character(10) COLLATE pg_catalog."default",
    idr SERIAL,
    spdan numeric(20,10) NOT NULL DEFAULT 0,
    spstupne numeric(20,10) NOT NULL DEFAULT 0,
    idriadok integer NOT NULL DEFAULT 0,
    CONSTRAINT <TABLENAME>_idr PRIMARY KEY (idr)
#[ CREATE TABLE KONEC ]#

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

	TRUNCATE TABLE <SCHEMA>.<TABLENAME> ;

	DROP INDEX IF EXISTS <SCHEMA>.genstav_menostlp;
	CREATE INDEX genstav_menostlp
    ON <SCHEMA>.genstav USING btree
    (menostlp COLLATE pg_catalog."default" ASC NULLS LAST)
    TABLESPACE pg_default;
 
END IF;

#[ KONEC SOUBORU ]#