#[ ZACATEK SOUBORU ]#

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

#[ CREATE TABLE ZACATEK ]#
    u_cis character(7) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    cena_pl numeric(20,10) NOT NULL DEFAULT 0,
    druh_pl character(8) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    tip numeric(20,10),
    uzaverka character(17) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    mena character(3) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    cena_mena numeric(20,10) NOT NULL DEFAULT 0,
    c_data smallint NOT NULL DEFAULT 1,
    idriadok SERIAL,
    kompez smallint NOT NULL DEFAULT 0,
    fik character varying(39) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::character varying,
    bkp character varying(44) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::character varying,
    cas_odesl character varying(13) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::character varying,
    CONSTRAINT <TABLENAME>_<PRIMARYKEY> PRIMARY KEY (<PRIMARYKEY>)
#[ CREATE TABLE KONEC ]#

#[ IF EXIST ZACATEK ]#
#[ PRIMARYKEY ]#
	IF NOT EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='sk_plt_a' and column_name='poradi') THEN
		ALTER TABLE IF EXISTS <SCHEMA>.sk_plt_a ADD COLUMN poradi numeric(2, 0) NOT NULL DEFAULT 1;
	END IF;

	IF NOT EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='sk_plt_a' and column_name='fik') THEN
		ALTER TABLE <SCHEMA>.sk_plt_a ADD COLUMN fik character varying(39) NOT NULL DEFAULT '';
	END IF;

	IF NOT EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='sk_plt_a' and column_name='bkp') THEN
		ALTER TABLE <SCHEMA>.sk_plt_a ADD COLUMN bkp character varying(44) NOT NULL DEFAULT '';
	END IF;

	IF NOT EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='sk_plt_a' and column_name='cas_odesl') THEN
		ALTER TABLE <SCHEMA>.sk_plt_a ADD COLUMN cas_odesl character varying(13) NOT NULL DEFAULT '';
	END IF;

END IF;

#[ KONEC SOUBORU ]#