CREATE TABLE blc_application (id VARCHAR(36) NOT NULL, allowed_currencies VARCHAR(10485760), allowed_locales VARCHAR(10485760), 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, name VARCHAR(255), 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), CONSTRAINT blc_application_pkey PRIMARY KEY (id));
CREATE TABLE blc_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), visible_as_assigned CHAR(1) DEFAULT 'Y' NOT NULL, isolated_catalogs_order INTEGER NOT NULL, CONSTRAINT blc_application_catalog_pkey PRIMARY KEY (application_id, isolated_catalogs_order));
CREATE TABLE blc_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), vendor_ref VARCHAR(255), CONSTRAINT blc_catalog_pkey PRIMARY KEY (id));
CREATE TABLE blc_import (id VARCHAR(36) NOT NULL, application_id VARCHAR(36), author VARCHAR(255), change_container VARCHAR(65535), error_count BIGINT, error_message VARCHAR(65535), file_location VARCHAR(65535), file_type VARCHAR(60), importing_application_id VARCHAR(36), importing_catalog_id VARCHAR(36), importing_customer_context_id VARCHAR(36), importing_sandbox_id VARCHAR(36), importing_sandbox_name_to_create VARCHAR(255), included_headers VARCHAR(65535), last_updated TIMESTAMP WITHOUT TIME ZONE, name VARCHAR(255), parameters VARCHAR(65535), parent_entity_id VARCHAR(36), production_import CHAR(1) DEFAULT 'N' NOT NULL, started TIMESTAMP WITHOUT TIME ZONE, status VARCHAR(60), stopped TIMESTAMP WITHOUT TIME ZONE, success_count BIGINT, tenant_id VARCHAR(36), total_items BIGINT, type VARCHAR(60), vendor_ref VARCHAR(255), CONSTRAINT blc_import_pkey PRIMARY KEY (id));
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_import_batchitem_completion (id VARCHAR(36) NOT NULL, correlation_id VARCHAR(255), error_message VARCHAR(65535), import_id VARCHAR(36), line_number BIGINT, operation_type VARCHAR(60), record_type VARCHAR(60), resource_tier_identifier VARCHAR(36), row_contents VARCHAR(10485760), status VARCHAR(60), top_level_parent_correlation_id VARCHAR(255), CONSTRAINT blc_import_batchitem_completion_pkey PRIMARY KEY (id));
CREATE TABLE blc_catalog_ref (id VARCHAR(36) NOT NULL, exclusion_filters VARCHAR(10485760), inclusion_filters VARCHAR(10485760), mutability_type VARCHAR(60), parent_catalog_id VARCHAR(36), child_catalog_id VARCHAR(36) NOT NULL, parents_order INTEGER, CONSTRAINT blc_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_import_batch (id VARCHAR(36) NOT NULL, items VARCHAR(10485760), completed TIMESTAMP WITHOUT TIME ZONE, created TIMESTAMP WITHOUT TIME ZONE, import_id VARCHAR(36), status VARCHAR(60), CONSTRAINT blc_import_batch_pkey PRIMARY KEY (id));
CREATE TABLE blc_import_lob (id VARCHAR(36) NOT NULL, content TEXT, path VARCHAR(65535), CONSTRAINT blc_import_lob_pkey PRIMARY KEY (id));
ALTER TABLE blc_application_catalog ADD CONSTRAINT fkdaeorqo87oh0rdu1lfkpv3qow FOREIGN KEY (application_id) REFERENCES blc_application (id) ON UPDATE NO ACTION ON DELETE NO ACTION;
ALTER TABLE blc_catalog_ref ADD CONSTRAINT fkqa2huaj7r3r8ovdilb9h71x2k FOREIGN KEY (child_catalog_id) REFERENCES blc_catalog (id) ON UPDATE NO ACTION ON DELETE NO ACTION;
