Adding a new member tenant to consortium. mod-entities-links scope
Notice {member_tenant_id}, {central_tenant_id} placeholders in insert/select queries.
1. Copy authority table from central tenant to newly created member tenant
insert into {member_tenant_id}_mod_entities_links.authority(
SELECT id, natural_id, source_file_id, 'CONSORTIUM-' || source, heading, heading_type, _version, subject_heading_code, sft_headings, saft_headings, identifiers, notes, deleted, created_date, updated_date, created_by_user_id, updated_by_user_id
FROM {central_tenant_id}_mod_entities_links.authority);2. Copy authority_data_stat table from central tenant to newly created member tenant
insert into {member_tenant_id}_mod_entities_links.authority_data_stat(
SELECT id, authority_id, action::text::{member_tenant_id}_mod_entities_links.authoritydatastataction, authority_natural_id_old, authority_natural_id_new, heading_old, heading_new, heading_type_old, heading_type_new, authority_source_file_old, authority_source_file_new, lb_total, lb_updated, lb_failed, status::text::{member_tenant_id}_mod_entities_links.authoritydatastatstatus, fail_cause, started_by_user_id, started_at, completed_at, updated_at
FROM {central_tenant_id}_mod_entities_links.authority_data_stat);3. Copy instance_authority_link table from central tenant to newly created member tenant
INSERT INTO {member_tenant_id}_mod_entities_links.instance_authority_link(
SELECT id, authority_id, instance_id, status::text::{member_tenant_id}_mod_entities_links.linkstatus, error_cause, updated_at, linking_rule_id
FROM {central_tenant_id}_mod_entities_links.instance_authority_link);Additions from Quesnelia (R1 2024) release:
4. Copy authority_source_file table from central tenant to newly created member tenant
insert into {member_tenant_id}_mod_entities_links.authority_source_file(
SELECT id, name, type, base_url, 'CONSORTIUM', created_date, updated_date, created_by_user_id, updated_by_user_id, sequence_name, selectable, hrid_start_number
FROM {central_tenant_id}_mod_entities_links.authority_source_file)
ON CONFLICT (id)
DO UPDATE SET source = 'CONSORTIUM'5. Copy authority_source_file_code table from central tenant to newly created member tenant
insert into {member_tenant_id}_mod_entities_links.authority_source_file_code(
SELECT id, authority_source_file_id, code
FROM {central_tenant_id}_mod_entities_links.authority_source_file_code)
ON CONFLICT (id)
DO NOTHING