#[ ZACATEK SOUBORU ]#

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

#[ CREATE TABLE ZACATEK ]#
    strana integer NOT NULL DEFAULT (0)::integer,
    pozice integer NOT NULL DEFAULT (0)::integer,
    stlpec integer NOT NULL DEFAULT (0)::integer,
    riadok integer NOT NULL DEFAULT (0)::integer,
    caption character(30) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    typ character(4) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    vazba integer NOT NULL DEFAULT (0)::integer,
    colo integer NOT NULL DEFAULT (0)::integer,
    barva character(10) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    autonavrat character(1) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    caption1 character(30) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    caption2 character(30) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    caption3 character(30) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    caption4 character(30) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    velk_klp numeric(2,0) NOT NULL DEFAULT 3,
    c_data smallint NOT NULL DEFAULT 1,
    c_karty integer NOT NULL DEFAULT 0,
    umisteno integer NOT NULL DEFAULT 0,
    id character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    idriadok SERIAL,
    mod character(1) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    oblast character(1) COLLATE pg_catalog."default" NOT NULL DEFAULT 'A'::bpchar,
    hore integer NOT NULL DEFAULT 0,
    vyska integer NOT NULL DEFAULT 0,
    strom smallint NOT NULL DEFAULT 0,
    CONSTRAINT <TABLENAME>_<PRIMARYKEY> 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='klapkyn' and column_name='strom') THEN
		ALTER TABLE <SCHEMA>.klapkyn ADD COLUMN strom smallint NOT NULL DEFAULT 0;
	END IF;
END IF;

#[ KONEC SOUBORU ]#