Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Move to unique index syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
MadLittleMods committed Jul 24, 2021
1 parent bc896cc commit f231066
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@
CREATE TABLE IF NOT EXISTS insertion_events(
event_id TEXT NOT NULL,
room_id TEXT NOT NULL,
next_chunk_id TEXT NOT NULL,
UNIQUE (event_id)
next_chunk_id TEXT NOT NULL
);

CREATE INDEX IF NOT EXISTS insertion_events_event_id ON insertion_events(event_id);
CREATE UNIQUE INDEX IF NOT EXISTS insertion_events_event_id ON insertion_events(event_id);
CREATE INDEX IF NOT EXISTS insertion_events_next_chunk_id ON insertion_events(next_chunk_id);

-- Add a table that keeps track of all of the events we are inserting between.
Expand All @@ -32,21 +30,20 @@ CREATE INDEX IF NOT EXISTS insertion_events_next_chunk_id ON insertion_events(ne
CREATE TABLE IF NOT EXISTS insertion_event_edges(
event_id TEXT NOT NULL,
room_id TEXT NOT NULL,
insertion_prev_event_id TEXT NOT NULL,
UNIQUE (event_id)
insertion_prev_event_id TEXT NOT NULL
);

CREATE UNIQUE INDEX IF NOT EXISTS insertion_event_edges_event_id ON insertion_event_edges(event_id);
CREATE INDEX IF NOT EXISTS insertion_event_edges_insertion_room_id ON insertion_event_edges(room_id);
CREATE INDEX IF NOT EXISTS insertion_event_edges_event_id ON insertion_event_edges(event_id);
CREATE INDEX IF NOT EXISTS insertion_event_edges_insertion_prev_event_id ON insertion_event_edges(insertion_prev_event_id);

-- Add a table that keeps track of how each chunk is labeled. The chunks are
-- connected together based on an insertion events `next_chunk_id`.
CREATE TABLE IF NOT EXISTS chunk_events(
event_id TEXT NOT NULL,
room_id TEXT NOT NULL,
chunk_id TEXT NOT NULL,
UNIQUE (event_id)
chunk_id TEXT NOT NULL
);

CREATE UNIQUE INDEX IF NOT EXISTS chunk_events_event_id ON chunk_events(event_id);
CREATE INDEX IF NOT EXISTS chunk_events_chunk_id ON chunk_events(chunk_id);

0 comments on commit f231066

Please sign in to comment.