mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-28 09:13:09 -06:00
Create sequence if not exists
This commit is contained in:
parent
8859e0e86b
commit
cdf8126254
|
|
@ -39,7 +39,7 @@ const stateDataSchema = `
|
||||||
-- lookup a specific (type, state_key) pair for an event. It also makes it easy
|
-- lookup a specific (type, state_key) pair for an event. It also makes it easy
|
||||||
-- to read the state for a given state_block_nid ordered by (type, state_key)
|
-- to read the state for a given state_block_nid ordered by (type, state_key)
|
||||||
-- which in turn makes it easier to merge state data blocks.
|
-- which in turn makes it easier to merge state data blocks.
|
||||||
CREATE SEQUENCE roomserver_state_block_nid_seq START AT $1;
|
CREATE SEQUENCE IF NOT EXISTS roomserver_state_block_nid_seq;
|
||||||
CREATE TABLE IF NOT EXISTS roomserver_state_block (
|
CREATE TABLE IF NOT EXISTS roomserver_state_block (
|
||||||
state_block_nid bigint PRIMARY KEY DEFAULT nextval('roomserver_state_block_nid_seq'),
|
state_block_nid bigint PRIMARY KEY DEFAULT nextval('roomserver_state_block_nid_seq'),
|
||||||
state_block_hash BYTEA UNIQUE,
|
state_block_hash BYTEA UNIQUE,
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ const stateSnapshotSchema = `
|
||||||
-- because room state tends to accumulate small changes over time. Although if
|
-- because room state tends to accumulate small changes over time. Although if
|
||||||
-- the list of deltas becomes too long it becomes more efficient to encode
|
-- the list of deltas becomes too long it becomes more efficient to encode
|
||||||
-- the full state under single state_block_nid.
|
-- the full state under single state_block_nid.
|
||||||
CREATE SEQUENCE roomserver_state_snapshot_nid_seq START AT $1;
|
CREATE SEQUENCE IF NOT EXISTS roomserver_state_snapshot_nid_seq;
|
||||||
CREATE TABLE IF NOT EXISTS roomserver_state_snapshots (
|
CREATE TABLE IF NOT EXISTS roomserver_state_snapshots (
|
||||||
state_snapshot_nid bigint PRIMARY KEY DEFAULT nextval('roomserver_state_snapshot_nid_seq'),
|
state_snapshot_nid bigint PRIMARY KEY DEFAULT nextval('roomserver_state_snapshot_nid_seq'),
|
||||||
state_snapshot_hash BYTEA UNIQUE,
|
state_snapshot_hash BYTEA UNIQUE,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue