CREATE TABLE blc_notification_state (id VARCHAR(36) NOT NULL, acked CHAR(1) DEFAULT 'N' NOT NULL, attempts INTEGER, change_timestamp TIMESTAMP WITHOUT TIME ZONE, change_timestamp_ack TIMESTAMP WITHOUT TIME ZONE, container VARCHAR(36), entity_type VARCHAR(255) NOT NULL, message_type VARCHAR(255), message_value VARCHAR(10485760), notification_name VARCHAR(255), next_attempt TIMESTAMP WITHOUT TIME ZONE, stopped CHAR(1) DEFAULT 'N' NOT NULL, CONSTRAINT blc_notification_state_pkey PRIMARY KEY (id));
CREATE TABLE blc_resource_lock (id VARCHAR(36) NOT NULL, concept_key VARCHAR(255), context_id VARCHAR(36), lock_expiration_timestamp TIMESTAMP WITHOUT TIME ZONE, locked CHAR(1) DEFAULT 'N', sandbox_id VARCHAR(36), lock_timestamp TIMESTAMP WITHOUT TIME ZONE, token VARCHAR(255), type_alias VARCHAR(255), CONSTRAINT blc_resource_lock_pkey PRIMARY KEY (id));
CREATE TABLE blc_tenant_application (id VARCHAR(36) NOT NULL, allowed_currencies VARCHAR(10485760), allowed_locales VARCHAR(10485760), attributes VARCHAR(10485760), customer_context_id VARCHAR(36), deactivated CHAR(1) DEFAULT 'N' NOT NULL, default_currency VARCHAR(255), default_locale VARCHAR(255), identifier_type VARCHAR(60), identifier_value VARCHAR(255), is_marketplace CHAR(1) DEFAULT 'N' NOT NULL, logo_asset VARCHAR(10485760), name VARCHAR(255), portrait_asset VARCHAR(10485760), robots VARCHAR(65535), updated_timestamp TIMESTAMP WITHOUT TIME ZONE, token VARCHAR(255), trk_archived CHAR(1) DEFAULT 'N' NOT NULL, audit_creation_time TIMESTAMP WITHOUT TIME ZONE, audit_creator VARCHAR(60), audit_update_time TIMESTAMP WITHOUT TIME ZONE, audit_updater VARCHAR(60), trk_change_details VARCHAR(10485760), trk_tenant_id VARCHAR(36), CONSTRAINT blc_tenant_application_pkey PRIMARY KEY (id));
CREATE TABLE blc_tenant_application_catalog (application_id VARCHAR(36) NOT NULL, catalog_status VARCHAR(60), context_id VARCHAR(36), exclude_from_add CHAR(1) DEFAULT 'N' NOT NULL, implicit VARCHAR(36), mutability_type VARCHAR(60), name VARCHAR(255), type VARCHAR(255), visible_as_assigned CHAR(1) DEFAULT 'Y' NOT NULL, isolated_catalogs_order INTEGER NOT NULL, CONSTRAINT blc_tenant_application_catalog_pkey PRIMARY KEY (application_id, isolated_catalogs_order));
CREATE TABLE blc_tenant_catalog (id VARCHAR(36) NOT NULL, default_currency VARCHAR(255), hidden CHAR(1) DEFAULT 'N' NOT NULL, catalog_level BIGINT, catalog_locale VARCHAR(255), catalog_name VARCHAR(255), owning_application VARCHAR(36), updated_timestamp TIMESTAMP WITHOUT TIME ZONE, trk_archived CHAR(1) DEFAULT 'N' NOT NULL, audit_creation_time TIMESTAMP WITHOUT TIME ZONE, audit_creator VARCHAR(60), audit_update_time TIMESTAMP WITHOUT TIME ZONE, audit_updater VARCHAR(60), trk_change_details VARCHAR(10485760), trk_tenant_id VARCHAR(36), type VARCHAR(255), vendor_ref VARCHAR(255), CONSTRAINT blc_tenant_catalog_pkey PRIMARY KEY (id));
CREATE TABLE blc_tenant_mpl_appl_cat (id VARCHAR(36) NOT NULL, application_id VARCHAR(36) NOT NULL, catalog_id VARCHAR(36) NOT NULL, catalog_status VARCHAR(60), implicit VARCHAR(36), propagation_type VARCHAR(60), updated_timestamp TIMESTAMP WITHOUT TIME ZONE, trk_archived CHAR(1) DEFAULT 'N' NOT NULL, audit_creation_time TIMESTAMP WITHOUT TIME ZONE, audit_creator VARCHAR(60), audit_update_time TIMESTAMP WITHOUT TIME ZONE, audit_updater VARCHAR(60), trk_change_details VARCHAR(10485760), trk_tenant_id VARCHAR(36), vendor_ref VARCHAR(255), CONSTRAINT blc_tenant_mpl_appl_cat_pkey PRIMARY KEY (id));
CREATE TABLE blc_translation (id VARCHAR(36) NOT NULL, context_id VARCHAR(36), entity_field VARCHAR(255), entity_id VARCHAR(36), entity_type VARCHAR(255), locale VARCHAR(36), trk_application_context_id VARCHAR(36), trk_application_default_locale VARCHAR(255), trk_application_name VARCHAR(255), trk_archived CHAR(1) DEFAULT 'N' NOT NULL, audit_creation_time TIMESTAMP WITHOUT TIME ZONE, audit_creator VARCHAR(60), audit_update_time TIMESTAMP WITHOUT TIME ZONE, audit_updater VARCHAR(60), trk_catalog_context_id VARCHAR(36), trk_catalog_level BIGINT, trk_catalog_locale VARCHAR(255), trk_catalog_name VARCHAR(255), trk_parent_cat_context_id VARCHAR(36), trk_parent_cat_level BIGINT, trk_parent_cat_locale VARCHAR(255), trk_parent_cat_name VARCHAR(255), trk_change_details VARCHAR(10485760), trk_composite_sort_level numeric(11, 5), trk_creating_application_id VARCHAR(36), trk_current_message VARCHAR(255), trk_customer_context_id VARCHAR(36), trk_field_overrides VARCHAR(10485760), trk_level INTEGER, trk_max_field_versions VARCHAR(10485760), trk_sandbox_archived CHAR(1) DEFAULT 'N' NOT NULL, trk_sub_container_catalog VARCHAR(36), trk_change_container_id VARCHAR(36), trk_change_container_name VARCHAR(255), trk_change_container_route_key VARCHAR(60), trk_sub_container_name VARCHAR(255), trk_sandbox_change_type VARCHAR(60), trk_sandbox_context_id VARCHAR(36), trk_sandbox_name VARCHAR(255), trk_sandbox_owner VARCHAR(60), trk_sandbox_stage VARCHAR(60), trk_tenant_id VARCHAR(36), translation_value VARCHAR(10485760), CONSTRAINT blc_translation_pkey PRIMARY KEY (id));
CREATE TABLE blc_tenant_catalog_ref (id VARCHAR(36) NOT NULL, exclusion_filters VARCHAR(10485760), inclusion_filters VARCHAR(10485760), mutability_type VARCHAR(60), name VARCHAR(255), parent_catalog_id VARCHAR(36), child_catalog_id VARCHAR(36) NOT NULL, parents_order INTEGER, CONSTRAINT blc_tenant_catalog_ref_pkey PRIMARY KEY (id));
ALTER TABLE blc_resource_lock ADD CONSTRAINT uk7iegjt4gojv24q9bw8k0i4j0c UNIQUE (context_id, type_alias, sandbox_id, concept_key);
CREATE TABLE blc_tenant (id VARCHAR(36) NOT NULL, allowed_currencies VARCHAR(10485760), allowed_locales VARCHAR(10485760), attributes VARCHAR(10485760), default_currency VARCHAR(255), default_locale VARCHAR(255), identifier_type VARCHAR(60), identifier_value VARCHAR(255), logo_asset VARCHAR(10485760), tenant_name VARCHAR(255), timestamp TIMESTAMP WITHOUT TIME ZONE, CONSTRAINT blc_tenant_pkey PRIMARY KEY (id));
ALTER TABLE blc_tenant_catalog_ref ADD CONSTRAINT fk3wy1hja4t42wv6cyw5ue35vjb FOREIGN KEY (child_catalog_id) REFERENCES blc_tenant_catalog (id) ON UPDATE NO ACTION ON DELETE NO ACTION;
ALTER TABLE blc_tenant_application_catalog ADD CONSTRAINT fktq6e98t5clvh1wvnyexambm5e FOREIGN KEY (application_id) REFERENCES blc_tenant_application (id) ON UPDATE NO ACTION ON DELETE NO ACTION;
