diff --git a/schema/mysql/v57/temporal/schema.sql b/schema/mysql/v57/temporal/schema.sql index db655cc9487..81feaa0c8f9 100644 --- a/schema/mysql/v57/temporal/schema.sql +++ b/schema/mysql/v57/temporal/schema.sql @@ -66,19 +66,17 @@ CREATE TABLE current_executions( ); CREATE TABLE buffered_events ( - id BIGINT AUTO_INCREMENT NOT NULL, shard_id INT NOT NULL, namespace_id BINARY(16) NOT NULL, workflow_id VARCHAR(255) NOT NULL, run_id BINARY(16) NOT NULL, + id BIGINT AUTO_INCREMENT NOT NULL UNIQUE, -- data MEDIUMBLOB NOT NULL, data_encoding VARCHAR(16) NOT NULL, - PRIMARY KEY (id) + PRIMARY KEY (shard_id, namespace_id, workflow_id, run_id, id) ); -CREATE INDEX buffered_events_by_events_ids ON buffered_events(shard_id, namespace_id, workflow_id, run_id); - CREATE TABLE tasks ( range_hash INT UNSIGNED NOT NULL, task_queue_id VARBINARY(255) NOT NULL, diff --git a/schema/mysql/v57/temporal/versioned/v1.0/schema.sql b/schema/mysql/v57/temporal/versioned/v1.0/schema.sql index 0b4dacba9ca..ca624de9c1b 100644 --- a/schema/mysql/v57/temporal/versioned/v1.0/schema.sql +++ b/schema/mysql/v57/temporal/versioned/v1.0/schema.sql @@ -66,19 +66,17 @@ CREATE TABLE current_executions( ); CREATE TABLE buffered_events ( - id BIGINT AUTO_INCREMENT NOT NULL, shard_id INT NOT NULL, namespace_id BINARY(16) NOT NULL, workflow_id VARCHAR(255) NOT NULL, run_id BINARY(16) NOT NULL, + id BIGINT AUTO_INCREMENT NOT NULL UNIQUE, -- data MEDIUMBLOB NOT NULL, data_encoding VARCHAR(16) NOT NULL, - PRIMARY KEY (id) + PRIMARY KEY (shard_id, namespace_id, workflow_id, run_id, id) ); -CREATE INDEX buffered_events_by_events_ids ON buffered_events(shard_id, namespace_id, workflow_id, run_id); - CREATE TABLE tasks ( range_hash INT UNSIGNED NOT NULL, task_queue_id VARBINARY(255) NOT NULL, diff --git a/schema/postgres/temporal/schema.sql b/schema/postgres/temporal/schema.sql index 25706c81aae..3962475b3a7 100644 --- a/schema/postgres/temporal/schema.sql +++ b/schema/postgres/temporal/schema.sql @@ -66,19 +66,17 @@ CREATE TABLE current_executions( ); CREATE TABLE buffered_events ( - id BIGSERIAL NOT NULL, shard_id INTEGER NOT NULL, namespace_id BYTEA NOT NULL, workflow_id VARCHAR(255) NOT NULL, run_id BYTEA NOT NULL, + id BIGSERIAL NOT NULL UNIQUE, -- data BYTEA NOT NULL, data_encoding VARCHAR(16) NOT NULL, - PRIMARY KEY (id) + PRIMARY KEY (shard_id, namespace_id, workflow_id, run_id, id) ); -CREATE INDEX buffered_events_by_events_ids ON buffered_events(shard_id, namespace_id, workflow_id, run_id); - CREATE TABLE tasks ( range_hash BIGINT NOT NULL, task_queue_id BYTEA NOT NULL, diff --git a/schema/postgres/temporal/versioned/v1.0/schema.sql b/schema/postgres/temporal/versioned/v1.0/schema.sql index 25706c81aae..3962475b3a7 100644 --- a/schema/postgres/temporal/versioned/v1.0/schema.sql +++ b/schema/postgres/temporal/versioned/v1.0/schema.sql @@ -66,19 +66,17 @@ CREATE TABLE current_executions( ); CREATE TABLE buffered_events ( - id BIGSERIAL NOT NULL, shard_id INTEGER NOT NULL, namespace_id BYTEA NOT NULL, workflow_id VARCHAR(255) NOT NULL, run_id BYTEA NOT NULL, + id BIGSERIAL NOT NULL UNIQUE, -- data BYTEA NOT NULL, data_encoding VARCHAR(16) NOT NULL, - PRIMARY KEY (id) + PRIMARY KEY (shard_id, namespace_id, workflow_id, run_id, id) ); -CREATE INDEX buffered_events_by_events_ids ON buffered_events(shard_id, namespace_id, workflow_id, run_id); - CREATE TABLE tasks ( range_hash BIGINT NOT NULL, task_queue_id BYTEA NOT NULL,