-- YugabyteDb supports `IF NOT EXISTS` syntax when creating indexes.
-- If an index already exists with the same name, it will not be duplicated.
-- However, you should still review your pre-existing indexes in advance
-- to make sure you do not already have one or more of the same indexes
-- defined under a different name. If so, you should omit them
-- from what you apply to your YugabyteDb database.

CREATE TABLE blc_change_summary (id VARCHAR(36) NOT NULL, archived CHAR(1) DEFAULT 'N' NOT NULL, author VARCHAR(60), trk_change_details VARCHAR(10485760), trk_field_overrides VARCHAR(10485760), trk_max_field_versions VARCHAR(10485760), 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, 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_creating_application_id VARCHAR(36), trk_current_message VARCHAR(255), trk_level INTEGER, 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), display_name VARCHAR(255), domain_alias VARCHAR(60), domain_context_id VARCHAR(36), entity_type VARCHAR(255), transition_exception VARCHAR(10485760), index IF NOT EXISTSable_processed CHAR(1) DEFAULT 'N' NOT NULL, indexable_target_id VARCHAR(36), indexable_type VARCHAR(60), remove_temp_override CHAR(1) DEFAULT 'N' NOT NULL, promotion_id VARCHAR(36), reject_message VARCHAR(255), sandbox VARCHAR(36), state VARCHAR(60), status VARCHAR(60), status_change_time TIMESTAMP WITHOUT TIME ZONE, transition_marker VARCHAR(36), vendor_ref VARCHAR(255), CONSTRAINT blc_change_summary_pkey PRIMARY KEY (id));
CREATE INDEX IF NOT EXISTS idxosj785tkew6sxuw6sd26k70qk ON blc_application_catalog(context_id);
CREATE INDEX IF NOT EXISTS idxlj2n3wdt6u930s8c5g28hh0yr ON blc_application_catalog(application_id);
CREATE INDEX IF NOT EXISTS idxo9ysroyx17nrb02mef9qf3qjl ON blc_catalog(vendor_ref);
CREATE INDEX IF NOT EXISTS idx1swm3w6cwnt8gvt8mad3ctbqn ON blc_catalog(owning_application);
CREATE INDEX IF NOT EXISTS idxihvg4sxhg7vy2wabgxxbw5hms ON blc_change_deploy(application, state);
CREATE INDEX IF NOT EXISTS idxh32lne3ixbepvh5rr6eekpdqu ON blc_change_summary(author, sandbox);
CREATE INDEX IF NOT EXISTS idx5padhspwpecyv5ub42ytumell ON blc_change_summary(domain_context_id, domain_alias, entity_type, author, sandbox);
CREATE INDEX IF NOT EXISTS idxn16c4rpnhkdt18cxe83yy6s9w ON blc_change_summary(transition_marker);
CREATE INDEX IF NOT EXISTS idx4yhqvpe4g6ryvpwh87wskv1ru ON blc_change_summary_group(sandbox, state);
CREATE INDEX IF NOT EXISTS idx7i0i5vcl1dkkwuq5dyc88wem5 ON blc_notification_state(acked);
CREATE INDEX IF NOT EXISTS idxgfaqe3xmq5q4yh78mix1g04fy ON blc_notification_state(container);
CREATE INDEX IF NOT EXISTS idxkm4y3qj3jh2mpt0rt6l6vscl8 ON blc_resource_lock(token);
CREATE INDEX IF NOT EXISTS idxf8yv5lwyf62ifctb6h19b8ks8 ON blc_sandbox(name);
CREATE INDEX IF NOT EXISTS idx1fi9wnq6ewrubid3npnnyqx8l ON blc_sandbox(application);
CREATE INDEX IF NOT EXISTS fkqa2huaj7r3r8ovdilb9h71x2k_idx ON blc_catalog_ref(child_catalog_id);
CREATE INDEX IF NOT EXISTS fkpib48x6689981wh37um18g7mx_idx ON blc_change_deploy_vendor_xref(change_deploy_id);
CREATE INDEX IF NOT EXISTS fkivhr0sdt80uusipvyidw5btb3_idx ON blc_change_group_vendor_xref(change_group_id);
CREATE INDEX IF NOT EXISTS idxysrmtlej61uxhx0yiwpb2rcrv ON blc_notification_state(acked, stopped, notification_name, change_timestamp, next_attempt);
