#[ ZACATEK SOUBORU ]#

#DEF <SCHEMA>    food600
#DEF <PRIMARYKEY> id
#DEF <TABLENAME> food_dat

#[ CREATE TABLE ZACATEK ]#
    id character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    id_menu character(10) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    pgm character(12) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    pgm_param character(12) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    pgm_path character(100) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    dat_path character(100) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    cen_path character(100) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    c_data smallint NOT NULL DEFAULT 1,
    id_zkratka character(30) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    c_stredisk integer NOT NULL DEFAULT 0,
    priority integer NOT NULL DEFAULT 0,
    skupina character(1) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    comment character(50) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    bour_skup character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    setup_skup character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    prava_skup character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    stredskup character(4) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    a1 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '01'::bpchar,
    a2 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '02'::bpchar,
    a3 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '03'::bpchar,
    a4 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '04'::bpchar,
    a5 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '05'::bpchar,
    a6 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '06'::bpchar,
    a7 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '07'::bpchar,
    a8 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '08'::bpchar,
    a9 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '09'::bpchar,
    b1 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '01'::bpchar,
    b2 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '02'::bpchar,
    b3 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '03'::bpchar,
    b4 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '04'::bpchar,
    b5 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '05'::bpchar,
    b6 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '06'::bpchar,
    b7 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '07'::bpchar,
    b8 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '08'::bpchar,
    b9 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '09'::bpchar,
    c1 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '01'::bpchar,
    c2 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '02'::bpchar,
    c3 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '03'::bpchar,
    c4 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '04'::bpchar,
    c5 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '05'::bpchar,
    c6 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '06'::bpchar,
    c7 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '07'::bpchar,
    c8 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '08'::bpchar,
    c9 character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT '09'::bpchar,
    id_klapky character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    pozadi character(30) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    defa_prn character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    zadan_prn character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    era_cen character(5) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    typ_inst integer NOT NULL DEFAULT 0,
    kont_dbf smallint NOT NULL DEFAULT 0,
    sankcnicen character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT ' '::bpchar,
    master_kas character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT ' '::bpchar,
    plateny smallint NOT NULL DEFAULT 1,
    servis smallint NOT NULL DEFAULT 1,
    datinst date NOT NULL DEFAULT (now())::date,
    edi_kod character(15) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    id_prev character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    prevadzka character(30) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    eet_dic character(12) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    eet_dic2 character(12) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    eet_provoz character(10) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    eet_kasa character(10) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    eet_url character(99) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    eet_url2 character(99) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    id_ediprev integer NOT NULL DEFAULT 0,
    CONSTRAINT food_dat_pkey PRIMARY KEY (id)
#[ CREATE TABLE KONEC ]#

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

ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN id SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN id_menu SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN id_menu SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN pgm SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN pgm SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN pgm_param SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN pgm_param SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN pgm_path SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN pgm_path SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN dat_path SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN dat_path SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN cen_path SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN cen_path SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN id_zkratka SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN id_zkratka SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN c_stredisk SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN priority SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN skupina SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN skupina SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN comment SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN comment SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN bour_skup SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN bour_skup SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN setup_skup SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN setup_skup SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN prava_skup SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN prava_skup SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN stredskup SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN stredskup SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN a1 SET DEFAULT '01'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN a1 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN a2 SET DEFAULT '02'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN a2 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN a3 SET DEFAULT '03'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN a3 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN a4 SET DEFAULT '04'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN a4 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN a5 SET DEFAULT '05'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN a5 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN a6 SET DEFAULT '06'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN a6 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN a7 SET DEFAULT '07'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN a7 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN a8 SET DEFAULT '08'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN a8 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN a9 SET DEFAULT '09'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN a9 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN b1 SET DEFAULT '01'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN b1 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN b2 SET DEFAULT '02'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN b2 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN b3 SET DEFAULT '03'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN b3 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN b4 SET DEFAULT '04'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN b4 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN b5 SET DEFAULT '05'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN b5 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN b6 SET DEFAULT '06'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN b6 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN b7 SET DEFAULT '07'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN b7 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN b8 SET DEFAULT '08'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN b8 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN b9 SET DEFAULT '09'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN b9 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN c1 SET DEFAULT '01'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN c1 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN c2 SET DEFAULT '02'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN c2 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN c3 SET DEFAULT '03'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN c3 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN c4 SET DEFAULT '04'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN c4 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN c5 SET DEFAULT '05'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN c5 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN c6 SET DEFAULT '06'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN c6 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN c7 SET DEFAULT '07'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN c7 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN c8 SET DEFAULT '08'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN c8 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN c9 SET DEFAULT '09'::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN c9 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN id_klapky SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN id_klapky SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN pozadi SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN pozadi SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN defa_prn SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN defa_prn SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN zadan_prn SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN zadan_prn SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN era_cen SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN era_cen SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN typ_inst SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat  ALTER COLUMN kont_dbf SET NOT NULL;

UPDATE <SCHEMA>.food_dat SET id_menu='' WHERE id_menu IS NULL;
UPDATE <SCHEMA>.food_dat SET pgm ='' WHERE pgm IS NULL;
UPDATE <SCHEMA>.food_dat SET pgm_param ='' WHERE pgm_param IS NULL;
UPDATE <SCHEMA>.food_dat SET pgm_path ='' WHERE pgm_path IS NULL;
UPDATE <SCHEMA>.food_dat SET dat_path ='' WHERE dat_path IS NULL;
UPDATE <SCHEMA>.food_dat SET cen_path ='' WHERE cen_path IS NULL;
UPDATE <SCHEMA>.food_dat SET id_zkratka ='' WHERE id_zkratka IS NULL;
UPDATE <SCHEMA>.food_dat SET c_stredisk=0 WHERE c_stredisk IS NULL;
UPDATE <SCHEMA>.food_dat SET priority=0 WHERE priority IS NULL;
UPDATE <SCHEMA>.food_dat SET skupina ='' WHERE skupina IS NULL;
UPDATE <SCHEMA>.food_dat SET comment ='' WHERE comment  IS NULL;
UPDATE <SCHEMA>.food_dat SET bour_skup ='' WHERE bour_skup IS NULL;
UPDATE <SCHEMA>.food_dat SET setup_skup ='' WHERE setup_skup IS NULL;
UPDATE <SCHEMA>.food_dat SET prava_skup ='' WHERE prava_skup IS NULL;
UPDATE <SCHEMA>.food_dat SET stredskup ='' WHERE stredskup IS NULL;
UPDATE <SCHEMA>.food_dat SET a1='01' WHERE a1 IS NULL;
UPDATE <SCHEMA>.food_dat SET a2='02' WHERE a2 IS NULL;
UPDATE <SCHEMA>.food_dat SET a3='03' WHERE a3 IS NULL;
UPDATE <SCHEMA>.food_dat SET a4='04' WHERE a4 IS NULL;
UPDATE <SCHEMA>.food_dat SET a5='05' WHERE a5 IS NULL;
UPDATE <SCHEMA>.food_dat SET a6='06' WHERE a6 IS NULL;
UPDATE <SCHEMA>.food_dat SET a7='07' WHERE a7 IS NULL;
UPDATE <SCHEMA>.food_dat SET a8='08' WHERE a8 IS NULL;
UPDATE <SCHEMA>.food_dat SET a9='09' WHERE a9 IS NULL;
UPDATE <SCHEMA>.food_dat SET b1='01' WHERE b1 IS NULL;
UPDATE <SCHEMA>.food_dat SET b2='02' WHERE b2 IS NULL;
UPDATE <SCHEMA>.food_dat SET b3='03' WHERE b3 IS NULL;
UPDATE <SCHEMA>.food_dat SET b4='04' WHERE b4 IS NULL;
UPDATE <SCHEMA>.food_dat SET b5='05' WHERE b5 IS NULL;
UPDATE <SCHEMA>.food_dat SET b6='06' WHERE b6 IS NULL;
UPDATE <SCHEMA>.food_dat SET b7='07' WHERE b7 IS NULL;
UPDATE <SCHEMA>.food_dat SET b8='08' WHERE b8 IS NULL;
UPDATE <SCHEMA>.food_dat SET b9='09' WHERE b9 IS NULL;
UPDATE <SCHEMA>.food_dat SET c1='01' WHERE c1 IS NULL;
UPDATE <SCHEMA>.food_dat SET c2='02' WHERE c2 IS NULL;
UPDATE <SCHEMA>.food_dat SET c3='03' WHERE c3 IS NULL;
UPDATE <SCHEMA>.food_dat SET c4='04' WHERE c4 IS NULL;
UPDATE <SCHEMA>.food_dat SET c5='05' WHERE c5 IS NULL;
UPDATE <SCHEMA>.food_dat SET c6='06' WHERE c6 IS NULL;
UPDATE <SCHEMA>.food_dat SET c7='07' WHERE c7 IS NULL;
UPDATE <SCHEMA>.food_dat SET c8='08' WHERE c8 IS NULL;
UPDATE <SCHEMA>.food_dat SET c9='09' WHERE c9 IS NULL;
UPDATE <SCHEMA>.food_dat SET id_klapky ='' WHERE id_klapky IS NULL;
UPDATE <SCHEMA>.food_dat SET pozadi ='' WHERE pozadi IS NULL;
UPDATE <SCHEMA>.food_dat SET defa_prn ='' WHERE defa_prn IS NULL;
UPDATE <SCHEMA>.food_dat SET zadan_prn ='' WHERE zadan_prn IS NULL;
UPDATE <SCHEMA>.food_dat SET era_cen ='' WHERE era_cen IS NULL;
UPDATE <SCHEMA>.food_dat SET typ_inst=0 WHERE typ_inst IS NULL;
UPDATE <SCHEMA>.food_dat SET kont_dbf=0 WHERE kont_dbf IS NULL;
UPDATE <SCHEMA>.food_dat SET id_ediprev=0 WHERE id_ediprev IS NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN id_menu SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN id_menu SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN pgm SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN pgm SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN pgm_param SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN pgm_param SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN pgm_path SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN pgm_path SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN dat_path SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN dat_path SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN cen_path SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN cen_path SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN id_zkratka SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN id_zkratka SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN c_stredisk SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN priority SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN skupina SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN skupina SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN comment SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN comment SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN bour_skup SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN bour_skup SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN setup_skup SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN setup_skup SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN prava_skup SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN prava_skup SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN stredskup SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN stredskup SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN a1 SET DEFAULT '01'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN a1 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN a2 SET DEFAULT '02'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN a2 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN a3 SET DEFAULT '03'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN a3 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN a4 SET DEFAULT '04'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN a4 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN a5 SET DEFAULT '05'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN a5 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN a6 SET DEFAULT '06'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN a6 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN a7 SET DEFAULT '07'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN a7 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN a8 SET DEFAULT '08'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN a8 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN a9 SET DEFAULT '09'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN a9 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN b1 SET DEFAULT '01'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN b1 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN b2 SET DEFAULT '02'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN b2 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN b3 SET DEFAULT '03'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN b3 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN b4 SET DEFAULT '04'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN b4 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN b5 SET DEFAULT '05'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN b5 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN b6 SET DEFAULT '06'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN b6 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN b7 SET DEFAULT '07'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN b7 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN b8 SET DEFAULT '08'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN b8 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN b9 SET DEFAULT '09'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN b9 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN c1 SET DEFAULT '01'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN c1 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN c2 SET DEFAULT '02'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN c2 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN c3 SET DEFAULT '03'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN c3 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN c4 SET DEFAULT '04'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN c4 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN c5 SET DEFAULT '05'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN c5 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN c6 SET DEFAULT '06'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN c6 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN c7 SET DEFAULT '07'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN c7 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN c8 SET DEFAULT '08'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN c8 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN c9 SET DEFAULT '09'::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN c9 SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN id_klapky SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN id_klapky SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN pozadi SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN pozadi SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN defa_prn SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN defa_prn SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN zadan_prn SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN zadan_prn SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN era_cen SET DEFAULT ''::bpchar;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN era_cen SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN typ_inst SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN kont_dbf SET NOT NULL;
ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN id_ediprev SET NOT NULL;

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

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

	IF NOT EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='food_dat' and column_name='datinst') THEN
		ALTER TABLE <SCHEMA>.food_dat ADD COLUMN datinst date NOT NULL DEFAULT now()::DATE;
	END IF;


IF not EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='food_dat' and column_name='eet_dic') THEN
			ALTER TABLE <SCHEMA>.food_dat  ADD COLUMN eet_dic character(12) NOT NULL DEFAULT '';
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='food_dat' and column_name='eet_dic2') THEN
			ALTER TABLE <SCHEMA>.food_dat  ADD COLUMN eet_dic2 character(12) NOT NULL DEFAULT '';
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='food_dat' and column_name='eet_provoz') THEN
			ALTER TABLE <SCHEMA>.food_dat  ADD COLUMN eet_provoz character(10) NOT NULL DEFAULT '';
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='food_dat' and column_name='eet_kasa') THEN
			ALTER TABLE <SCHEMA>.food_dat  ADD COLUMN eet_kasa character(10) NOT NULL DEFAULT '';
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='food_dat' and column_name='eet_url') THEN
			ALTER TABLE <SCHEMA>.food_dat  ADD COLUMN eet_url character(99) NOT NULL DEFAULT '';
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='food_dat' and column_name='eet_url2') THEN
			ALTER TABLE <SCHEMA>.food_dat  ADD COLUMN eet_url2 character(99) NOT NULL DEFAULT '';
END IF;

IF NOT EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='food_dat' and column_name='id_ediprev') THEN
	ALTER TABLE <SCHEMA>.food_dat   ADD COLUMN id_ediprev INTEGER DEFAULT 0;
END IF;

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

IF not EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='food_dat' and column_name='id_prev') THEN
			ALTER TABLE <SCHEMA>.food_dat ADD COLUMN id_prev character(2) NOT NULL DEFAULT '';
END IF;
IF not EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='food_dat' and column_name='prevadzka') THEN
			ALTER TABLE <SCHEMA>.food_dat ADD COLUMN prevadzka character(30) NOT NULL DEFAULT '';
END IF;

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

	IF NOT EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='food_dat' and column_name='id_sync') THEN
		ALTER TABLE <SCHEMA>.food_dat  ADD COLUMN id_sync integer NOT NULL DEFAULT 0;
	END IF;
	
	IF NOT EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='food_dat' and column_name='idmaster') AND
	   EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='food_dat' and column_name='id_master') THEN
		ALTER TABLE <SCHEMA>.food_dat   RENAME id_master TO idmaster;
	END IF;

	 IF  EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='food_dat' and column_name='id_master') THEN
		ALTER TABLE <SCHEMA>.food_dat   DROP id_master ;
	END IF;

IF EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='food_dat' and column_name='pgm_path') THEN
                        ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN pgm_path TYPE bpchar(99) USING pgm_path::bpchar;
END IF;

IF EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='food_dat' and column_name='dat_path') THEN
                        ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN dat_path TYPE bpchar(99) USING dat_path::bpchar;
END IF;

IF EXISTS (SELECT column_name FROM information_schema.columns WHERE table_schema='<SCHEMA>' and table_name='food_dat' and column_name='cen_path') THEN
                        ALTER TABLE <SCHEMA>.food_dat ALTER COLUMN cen_path TYPE bpchar(99) USING cen_path::bpchar;
END IF;


END IF;

#[ KONEC SOUBORU ]#