#[ ZACATEK SOUBORU ]#

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

#[ CREATE TABLE ZACATEK ]#
    idriadok SERIAL,
    c_karty integer NOT NULL DEFAULT 0,
    c_partner integer NOT NULL DEFAULT 0,
    ean character(25) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    poradie smallint NOT NULL DEFAULT 0,
    cena numeric(20,10) NOT NULL DEFAULT 0,
    c_data smallint NOT NULL DEFAULT 1,
    zaokruhlenie smallint NOT NULL DEFAULT 0,
    CONSTRAINT karty_objednavky_idriadok PRIMARY KEY (idriadok)
#[ CREATE TABLE KONEC ]#

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


COMMENT ON COLUMN <SCHEMA>.karty_objednavky.zaokruhlenie
    IS '0 - nezaokruhlovat,1 - celé nahor
>=1 polovica, tretina,....
<0 - des.miesta';

	IF not EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='karty_objednavky' and column_name='zaokruhlenie') THEN
		ALTER TABLE <SCHEMA>.karty_objednavky  ADD COLUMN zaokruhlenie smallint NOT NULL DEFAULT 0;
			COMMENT ON COLUMN <SCHEMA>.karty_objednavky.zaokruhlenie IS '0 - nezaokruhlovat,1 - celé nahor
				>=1 polovica, tretina,....
				<0 - des.miesta';
	END IF;

END IF;


#[ KONEC SOUBORU ]#