CREATE TABLE blc_notification_state (id VARCHAR(36) NOT NULL, acked CHAR(1) DEFAULT 'N' NOT NULL, attempts INT DEFAULT NULL NULL, change_timestamp datetime DEFAULT NULL NULL, change_timestamp_ack datetime DEFAULT NULL NULL, container VARCHAR(36) NULL, entity_type VARCHAR(255) NOT NULL, message_type VARCHAR(255) NULL, message_value LONGTEXT NULL, notification_name VARCHAR(255) NULL, next_attempt datetime DEFAULT NULL NULL, stopped CHAR(1) DEFAULT 'N' NOT NULL, CONSTRAINT PK_BLC_NOTIFICATION_STATE PRIMARY KEY (id));
CREATE TABLE blc_resource_lock (id VARCHAR(36) NOT NULL, concept_key VARCHAR(255) NULL, context_id VARCHAR(36) NULL, lock_expiration_timestamp datetime DEFAULT NULL NULL, `locked` CHAR(1) DEFAULT 'N' NULL, sandbox_id VARCHAR(36) NULL, lock_timestamp datetime DEFAULT NULL NULL, token VARCHAR(255) NULL, type_alias VARCHAR(255) NULL, CONSTRAINT PK_BLC_RESOURCE_LOCK PRIMARY KEY (id));
CREATE TABLE blc_scheduled_job (id VARCHAR(36) NOT NULL, author VARCHAR(255) NULL, cron VARCHAR(255) NULL, enabled CHAR(1) DEFAULT 'Y' NOT NULL, executed CHAR(1) DEFAULT 'N' NOT NULL, last_executed datetime DEFAULT NULL NULL, manage_in_admin CHAR(1) DEFAULT 'N' NOT NULL, name VARCHAR(255) NULL, target_date datetime DEFAULT NULL NULL, timing_type VARCHAR(60) NULL, trk_archived CHAR(1) DEFAULT 'N' NOT NULL, trk_change_details LONGTEXT NULL, trk_tenant_id VARCHAR(36) NULL, type VARCHAR(60) NULL, updated datetime DEFAULT NULL NULL, CONSTRAINT PK_BLC_SCHEDULED_JOB PRIMARY KEY (id));
CREATE TABLE blc_scheduled_job_detail (job_id VARCHAR(255) NOT NULL, name VARCHAR(60) NOT NULL, value_sha VARCHAR(255) NOT NULL, value LONGTEXT NOT NULL, details_order INT DEFAULT NULL NULL, CONSTRAINT PK_BLC_SCHEDULED_JOB_DETAIL PRIMARY KEY (job_id, name, value_sha));
ALTER TABLE blc_resource_lock ADD CONSTRAINT UK7iegjt4gojv24q9bw8k0i4j0c UNIQUE (context_id, type_alias, sandbox_id, concept_key);
CREATE INDEX IDX7i0i5vcl1dkkwuq5dyc88wem5 ON blc_notification_state(acked);
CREATE INDEX IDXgfaqe3xmq5q4yh78mix1g04fy ON blc_notification_state(container);
CREATE INDEX IDXkm4y3qj3jh2mpt0rt6l6vscl8 ON blc_resource_lock(token);
ALTER TABLE blc_scheduled_job_detail ADD CONSTRAINT FKeyphrinaon47uv7ojkbvbkp14 FOREIGN KEY (job_id) REFERENCES blc_scheduled_job (id) ON UPDATE RESTRICT ON DELETE RESTRICT;
