-- --------------------------------------------------------------
-- GLOBIS
-- --------------------------------------------------------------

ALTER TABLE "contract_type_person"
    ADD CONSTRAINT "contract_type_person_id" PRIMARY KEY ("id");

-- spôsobuje chybu, existujú dva záznamy s ID=2
ALTER TABLE "hw"
    ADD CONSTRAINT "hw_id" PRIMARY KEY ("id");

ALTER TABLE "hw_barcode"
    ADD CONSTRAINT "hw_barcode_id" PRIMARY KEY ("id");

ALTER TABLE "hw_brand"
    ADD CONSTRAINT "hw_brand_id" PRIMARY KEY ("id");

ALTER TABLE "hw_log"
    ADD CONSTRAINT "hw_log_id" PRIMARY KEY ("id");

ALTER TABLE "hw_status"
    ADD CONSTRAINT "hw_status_id" PRIMARY KEY ("id");

ALTER TABLE "hw_stock"
    ADD CONSTRAINT "hw_stock_id" PRIMARY KEY ("id");

ALTER TABLE "photo"
    ADD CONSTRAINT "photo_id" PRIMARY KEY ("id");

ALTER TABLE "photo_relation"
    ADD CONSTRAINT "photo_relation_id" PRIMARY KEY ("id");

ALTER TABLE "property"
    ADD CONSTRAINT "property_id" PRIMARY KEY ("id");

ALTER TABLE "property_part"
    ADD CONSTRAINT "property_part_id" PRIMARY KEY ("id");

ALTER TABLE "property_person"
    ADD CONSTRAINT "property_person_id" PRIMARY KEY ("id");

ALTER TABLE "property_person_role"
    ADD CONSTRAINT "property_person_role_id" PRIMARY KEY ("id");

ALTER TABLE "property_type"
    ADD CONSTRAINT "property_type_id" PRIMARY KEY ("id");

ALTER TABLE "tarifaccess"
    ADD CONSTRAINT "tarifaccess_id" PRIMARY KEY ("id");

ALTER TABLE "tarifitemacct"
    ADD CONSTRAINT "tarifitemacct_id" PRIMARY KEY ("id");

ALTER TABLE "tarifitemrate"
    ADD CONSTRAINT "tarifitemrate_id" PRIMARY KEY ("id");

ALTER TABLE "tarifitemtype"
    ADD CONSTRAINT "tarifitemtype_id" PRIMARY KEY ("id");

ALTER TABLE "tarifitemunit"
    ADD CONSTRAINT "tarifitemunit_id" PRIMARY KEY ("id");

ALTER TABLE "tarifpartner"
    ADD CONSTRAINT "tarifpartner_id" PRIMARY KEY ("id");

ALTER TABLE "task"
    ADD CONSTRAINT "task_id" PRIMARY KEY ("id");

ALTER TABLE "task_calc"
    ADD CONSTRAINT "task_calc_id" PRIMARY KEY ("id");

ALTER TABLE "task_calc_item"
    ADD CONSTRAINT "task_calc_item_id" PRIMARY KEY ("id");

ALTER TABLE "task_calc_type"
    ADD CONSTRAINT "task_calc_type_id" PRIMARY KEY ("id");

ALTER TABLE "task_location"
    ADD CONSTRAINT "task_location_id" PRIMARY KEY ("id");

ALTER TABLE "task_person"
    ADD CONSTRAINT "task_person_id" PRIMARY KEY ("id");

ALTER TABLE "task_priority"
    ADD CONSTRAINT "task_priority_id" PRIMARY KEY ("id");

ALTER TABLE "task_status"
    ADD CONSTRAINT "task_status_id" PRIMARY KEY ("id");

ALTER TABLE "task_tag"
    ADD CONSTRAINT "task_tag_id" PRIMARY KEY ("id");

ALTER TABLE "task_tag_relation"
    ADD CONSTRAINT "task_tag_relation_id" PRIMARY KEY ("id");

ALTER TABLE "task_tarifitem_role"
    ADD CONSTRAINT "task_tarifitem_role_id" PRIMARY KEY ("id");

ALTER TABLE "task_type"
    ADD CONSTRAINT "task_type_id" PRIMARY KEY ("id");

-- --------------------------------------------------------------
-- IPFON
-- --------------------------------------------------------------

ALTER TABLE "cpe_provsrv"
    ADD CONSTRAINT "cpe_provsrv_id" PRIMARY KEY ("id");

ALTER TABLE "cpe"
    ADD CONSTRAINT "cpe_id" PRIMARY KEY ("id");

ALTER TABLE "ipfon_phonebook_user"
    ADD CONSTRAINT "ipfon_phonebook_user_id" PRIMARY KEY ("id");

ALTER TABLE "pbx"
    ADD CONSTRAINT "pbx_id" PRIMARY KEY ("id");

ALTER TABLE "cpe_type"
    ADD CONSTRAINT "cpe_type_id" PRIMARY KEY ("id");

ALTER TABLE "pbx_acl"
    ADD CONSTRAINT "pbx_acl_id" PRIMARY KEY ("id");

ALTER TABLE "pbx_badge"
    ADD CONSTRAINT "pbx_badge_sysname" UNIQUE ("sysname");

ADD CONSTRAINT "pbx_badge_id" PRIMARY KEY ("id");

ALTER TABLE "pbx_callscript"
    ADD CONSTRAINT "pbx_callscript_id" PRIMARY KEY ("id");

ALTER TABLE "pbx_sound"
    ADD CONSTRAINT "pbx_sound_id" PRIMARY KEY ("id");

ALTER TABLE "pbx_sound_lang"
    ADD CONSTRAINT "pbx_sound_lang_id" PRIMARY KEY ("id"),
    ADD CONSTRAINT "pbx_sound_lang_sound_lang" UNIQUE ("sound", "lang");

ALTER TABLE "pbx_exten"
    ADD CONSTRAINT "pbx_exten_id" PRIMARY KEY ("id");

ALTER TABLE "pbx_host"
    ADD CONSTRAINT "pbx_host_id" PRIMARY KEY ("id");

ALTER TABLE "pbx_instance"
    ADD CONSTRAINT "pbx_instance_id" PRIMARY KEY ("id");

ALTER TABLE "ipfon_softswitch"
    ADD CONSTRAINT "ipfon_softswitch_id" PRIMARY KEY ("id");

ALTER TABLE "pbx_lang"
    ADD CONSTRAINT "pbx_lang_id" PRIMARY KEY ("id"),
    ADD CONSTRAINT "pbx_lang_sysname" UNIQUE ("sysname");

ALTER TABLE "pbx_line"
    ADD CONSTRAINT "pbx_line_id" PRIMARY KEY ("id"),
    ADD CONSTRAINT "pbx_line_pbx_sysname" UNIQUE ("pbx", "sysname");

ALTER TABLE "pbx_missedcall"
    ADD CONSTRAINT "pbx_missedcall_id" PRIMARY KEY ("id");

ALTER TABLE "pbx_missedcall_status"
    ADD CONSTRAINT "pbx_missedcall_status_id" PRIMARY KEY ("id"),
    ADD CONSTRAINT "pbx_missedcall_status_name" UNIQUE ("name");

ALTER TABLE "pbx_orggroup"
    ADD CONSTRAINT "pbx_orggroup_id" PRIMARY KEY ("id");

ALTER TABLE "pbx_queue"
    ADD CONSTRAINT "pbx_queue_id" PRIMARY KEY ("id");

