#[ ZACATEK SOUBORU ]#

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

#[ CREATE TABLE ZACATEK ]#
    c_karty integer NOT NULL DEFAULT (0)::integer,
    nazev character(30) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    id_kas character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    id_man character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    prn_no character(2) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    kod character(13) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    rkod character(13) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::bpchar,
    c_druhk integer NOT NULL DEFAULT (0)::integer,
    c_data smallint NOT NULL DEFAULT 1,
    idriadok SERIAL,
    oblasta smallint NOT NULL DEFAULT 1,
    oblastb smallint NOT NULL DEFAULT 1,
    oblastc smallint NOT NULL DEFAULT 1,
    zmena timestamp without time zone NOT NULL DEFAULT now(),
    CONSTRAINT <TABLENAME>_<PRIMARYKEY> PRIMARY KEY (<PRIMARYKEY>)
#[ CREATE TABLE KONEC ]#

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

	UPDATE <SCHEMA>.umisteni SET c_karty=0 WHERE c_karty IS NULL;
	UPDATE <SCHEMA>.umisteni SET nazev='' WHERE nazev IS NULL;
	UPDATE <SCHEMA>.umisteni SET id_kas='' WHERE id_kas IS NULL;
	UPDATE <SCHEMA>.umisteni SET id_man='' WHERE id_man IS NULL;
	UPDATE <SCHEMA>.umisteni SET prn_no='' WHERE prn_no IS NULL;
	UPDATE <SCHEMA>.umisteni SET kod='' WHERE kod IS NULL;
	UPDATE <SCHEMA>.umisteni SET rkod='' WHERE rkod IS NULL;
	UPDATE <SCHEMA>.umisteni SET c_druhk=0 WHERE c_druhk IS NULL;

	ALTER TABLE <SCHEMA>.umisteni   ALTER COLUMN c_karty SET NOT NULL;
	ALTER TABLE <SCHEMA>.umisteni   ALTER COLUMN nazev SET DEFAULT ''::bpchar;
	ALTER TABLE <SCHEMA>.umisteni   ALTER COLUMN nazev SET NOT NULL;
	ALTER TABLE <SCHEMA>.umisteni   ALTER COLUMN id_kas SET DEFAULT ''::bpchar;
	ALTER TABLE <SCHEMA>.umisteni   ALTER COLUMN id_kas SET NOT NULL;
	ALTER TABLE <SCHEMA>.umisteni   ALTER COLUMN id_man SET DEFAULT ''::bpchar;
	ALTER TABLE <SCHEMA>.umisteni   ALTER COLUMN id_man SET NOT NULL;
	ALTER TABLE <SCHEMA>.umisteni   ALTER COLUMN prn_no SET DEFAULT ''::bpchar;
	ALTER TABLE <SCHEMA>.umisteni   ALTER COLUMN prn_no SET NOT NULL;
	ALTER TABLE <SCHEMA>.umisteni   ALTER COLUMN kod SET DEFAULT ''::bpchar;
	ALTER TABLE <SCHEMA>.umisteni   ALTER COLUMN kod SET NOT NULL;
	ALTER TABLE <SCHEMA>.umisteni   ALTER COLUMN rkod SET DEFAULT ''::bpchar;
	ALTER TABLE <SCHEMA>.umisteni   ALTER COLUMN rkod SET NOT NULL;
	ALTER TABLE <SCHEMA>.umisteni   ALTER COLUMN c_druhk SET NOT NULL;

END IF;

#[ KONEC SOUBORU ]#