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_inventory_location (location_id VARCHAR(36) NOT NULL, address_1 VARCHAR(255), address_2 VARCHAR(255), address_3 VARCHAR(255), city VARCHAR(255), country_code VARCHAR(255), latitude FLOAT8, location_number VARCHAR(255), longitude FLOAT8, location_name VARCHAR(255), pickup_location CHAR(1) DEFAULT 'N' NOT NULL, postal_code VARCHAR(255), shipping_location CHAR(1) DEFAULT 'Y' NOT NULL, state_province_region_code VARCHAR(255), store_location CHAR(1) DEFAULT 'N' NOT NULL, updated_timestamp TIMESTAMP WITHOUT TIME ZONE, 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_change_details VARCHAR(10485760), trk_creating_application_id VARCHAR(36), trk_current_message VARCHAR(255), 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), vendor_ref VARCHAR(255), CONSTRAINT blc_inventory_location_pkey PRIMARY KEY (location_id));
CREATE TABLE blc_inventory_tx (inventory_tx_id VARCHAR(36) NOT NULL, batch_id VARCHAR(36) NOT NULL, date_created TIMESTAMP WITHOUT TIME ZONE NOT NULL, date_processed TIMESTAMP WITHOUT TIME ZONE, quantity INTEGER NOT NULL, reference_num VARCHAR(255), sku_inventory_id VARCHAR(255) NOT NULL, 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_change_details VARCHAR(10485760), trk_creating_application_id VARCHAR(36), trk_current_message VARCHAR(255), 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), tx_type VARCHAR(255) NOT NULL, CONSTRAINT blc_inventory_tx_pkey PRIMARY KEY (inventory_tx_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_sku_inventory (sku_inventory_id VARCHAR(36) NOT NULL, ean VARCHAR(13), external_id VARCHAR(255), gtin VARCHAR(14), location_id VARCHAR(36) NOT NULL, qty_available INTEGER NOT NULL, qty_on_hand INTEGER NOT NULL, qty_on_order INTEGER NOT NULL, qty_reserved INTEGER NOT NULL, safety_stock INTEGER NOT NULL, sku_code VARCHAR(255), sku_name VARCHAR(255), 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_change_details VARCHAR(10485760), trk_creating_application_id VARCHAR(36), trk_current_message VARCHAR(255), 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), upc VARCHAR(13), vendor_ref VARCHAR(255), CONSTRAINT blc_sku_inventory_pkey PRIMARY KEY (sku_inventory_id));
ALTER TABLE blc_resource_lock ADD CONSTRAINT uk7iegjt4gojv24q9bw8k0i4j0c UNIQUE (context_id, type_alias, sandbox_id, concept_key);
CREATE TABLE blc_export (id VARCHAR(36) NOT NULL, addl_parameters VARCHAR(10485760), application_id VARCHAR(36), author VARCHAR(255), created TIMESTAMP WITHOUT TIME ZONE, error_message VARCHAR(65535), exclusions VARCHAR(10485760), exporting_application_id VARCHAR(36), exporting_catalog_id VARCHAR(36), exporting_customer_context_id VARCHAR(36), exporting_sandbox_id VARCHAR(36), file_location VARCHAR(500), file_type VARCHAR(60), filter_string VARCHAR(65535), inclusions VARCHAR(10485760), last_updated TIMESTAMP WITHOUT TIME ZONE, name VARCHAR(255), number_of_records_to_process BIGINT, parent_id VARCHAR(36), status VARCHAR(60), target VARCHAR(60), tenant_id VARCHAR(36), time_zone_id VARCHAR(255), total_records_to_process BIGINT, CONSTRAINT blc_export_pkey PRIMARY KEY (id));
CREATE TABLE blc_export_lob (id VARCHAR(36) NOT NULL, content TEXT, path VARCHAR(500), CONSTRAINT blc_export_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;
