#[ ZACATEK SOUBORU ]#

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

#[ CREATE TABLE ZACATEK ]#
    c_karty integer NOT NULL DEFAULT 0,
    c_karty2 integer NOT NULL DEFAULT 0,
    nazev character(30) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    nazev2 character(30) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    mnozstvi numeric(20,10) NOT NULL DEFAULT 0,
    mnozstvi2 numeric(20,10) NOT NULL DEFAULT 0,
    mnoz_dod numeric(20,10) NOT NULL DEFAULT 0,
    cena numeric(20,10) NOT NULL DEFAULT 0,
    ean character(25) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    koef_mnoz numeric(20,10) NOT NULL DEFAULT 1,
    koef numeric(20,10) NOT NULL DEFAULT 1,
    partner character(25) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    c_partner integer NOT NULL DEFAULT 0,
    c_druh integer NOT NULL DEFAULT 0,
    druh character(10) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    ico character(15) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    dic character(15) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    objem numeric(20,10) NOT NULL DEFAULT 1,
    man_edikod smallint NOT NULL DEFAULT 0,
    pocetdod smallint NOT NULL DEFAULT 0,
    pocetskl smallint NOT NULL DEFAULT 0,
    stav numeric(20,10) NOT NULL DEFAULT 0,
    priemt numeric(20,10) NOT NULL DEFAULT 0,
    priemd numeric(20,10) NOT NULL DEFAULT 0,
    objednane numeric(20,10) NOT NULL DEFAULT 0,
    c_stredisk integer NOT NULL DEFAULT 0,
    popis character(50) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    menobuf character(10) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    idriadok SERIAL,
    zaokruhlenie smallint NOT NULL DEFAULT 0,
    CONSTRAINT bufferzad_idriadok PRIMARY KEY (idriadok)
#[ CREATE TABLE KONEC ]#


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

	IF not EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='bufferzad' and column_name='zaokruhlenie') THEN
		ALTER TABLE <SCHEMA>.bufferzad  ADD COLUMN zaokruhlenie smallint NOT NULL DEFAULT 0;
	END IF;

END IF;

#[ KONEC SOUBORU ]#