Skip to content

Commit

Permalink
fix: durable state store schema definition
Browse files Browse the repository at this point in the history
  • Loading branch information
Tochemey committed Dec 17, 2024
1 parent 9c75be3 commit c43fc33
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
8 changes: 3 additions & 5 deletions plugins/statestore/postgres/schema_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,12 @@ func (d SchemaUtils) CreateTable(ctx context.Context) error {
DROP TABLE IF EXISTS states_store;
CREATE TABLE IF NOT EXISTS states_store
(
persistence_id VARCHAR(255) NOT NULL,
version_number BIGINT NOT NULL,
persistence_id VARCHAR(255) PRIMARY KEY,
version_number BIGINT NOT NULL,
state_payload BYTEA NOT NULL,
state_manifest VARCHAR(255) NOT NULL,
timestamp BIGINT NOT NULL,
shard_number BIGINT NOT NULL ,
PRIMARY KEY (persistence_id, version_number)
shard_number BIGINT NOT NULL
);
`
_, err := d.db.Exec(ctx, schemaDDL)
Expand Down
7 changes: 2 additions & 5 deletions resources/durablestore_postgres.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,13 @@

CREATE TABLE IF NOT EXISTS states_store
(
persistence_id VARCHAR(255) NOT NULL,
persistence_id VARCHAR(255) PRIMARY KEY,
version_number BIGINT NOT NULL,
state_payload BYTEA NOT NULL,
state_manifest VARCHAR(255) NOT NULL,
timestamp BIGINT NOT NULL,
shard_number BIGINT NOT NULL,

PRIMARY KEY (persistence_id, version_number)
shard_number BIGINT NOT NULL
);

--- create an indexes
CREATE INDEX IF NOT EXISTS idx_states_store_persistence_id ON states_store(persistence_id);
CREATE INDEX IF NOT EXISTS idx_states_store_version_number ON states_store(version_number);

0 comments on commit c43fc33

Please sign in to comment.