From 64aeb7330dcb8ad109004545af0496ec74f7a0de Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Wed, 14 Jul 2021 01:42:51 -0500 Subject: [PATCH] Rename insertion_event_id to just event_id --- synapse/storage/databases/main/event_federation.py | 6 +++--- synapse/storage/databases/main/events.py | 4 ++-- .../main/delta/61/01insertion_event_lookups.sql | 12 ++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/synapse/storage/databases/main/event_federation.py b/synapse/storage/databases/main/event_federation.py index b2ba63c016..363b924365 100644 --- a/synapse/storage/databases/main/event_federation.py +++ b/synapse/storage/databases/main/event_federation.py @@ -951,10 +951,10 @@ class EventFederationWorkerStore(EventsWorkerStore, SignatureWorkerStore, SQLBas # Look for the "insertion" events connected to the given event_id # TODO: Do we need to worry about selecting only from the given room_id? The other query above doesn't connected_insertion_event_query = ( - "SELECT e.depth, i.insertion_event_id FROM insertion_event_edges AS i" + "SELECT e.depth, i.event_id FROM insertion_event_edges AS i" # Get the depth of the insertion event from the events table " INNER JOIN events AS e" - " ON e.event_id = i.insertion_event_id" + " ON e.event_id = i.event_id" # Find an insertion event which points via prev_events to the given event_id " WHERE i.insertion_prev_event_id = ?" " LIMIT ?" @@ -971,7 +971,7 @@ class EventFederationWorkerStore(EventsWorkerStore, SignatureWorkerStore, SQLBas " INNER JOIN events AS e" " ON e.event_id = c.event_id" # Find an insertion event which matches the given event_id - " WHERE i.insertion_event_id = ?" + " WHERE i.event_id = ?" " LIMIT ?" ) diff --git a/synapse/storage/databases/main/events.py b/synapse/storage/databases/main/events.py index b743876dff..db73b0e01f 100644 --- a/synapse/storage/databases/main/events.py +++ b/synapse/storage/databases/main/events.py @@ -1783,7 +1783,7 @@ class PersistEventsStore: txn, table="insertion_events", values={ - "insertion_event_id": event.event_id, + "event_id": event.event_id, "room_id": event.room_id, "next_chunk_id": next_chunk_id, }, @@ -1795,7 +1795,7 @@ class PersistEventsStore: txn, table="insertion_event_edges", values={ - "insertion_event_id": event.event_id, + "event_id": event.event_id, "room_id": event.room_id, "insertion_prev_event_id": prev_event_id, }, diff --git a/synapse/storage/schema/main/delta/61/01insertion_event_lookups.sql b/synapse/storage/schema/main/delta/61/01insertion_event_lookups.sql index 88cb22ec70..e908ea4390 100644 --- a/synapse/storage/schema/main/delta/61/01insertion_event_lookups.sql +++ b/synapse/storage/schema/main/delta/61/01insertion_event_lookups.sql @@ -19,25 +19,25 @@ -- the "insertion" event and start navigating from there. CREATE TABLE IF NOT EXISTS insertion_events( - insertion_event_id TEXT NOT NULL, + event_id TEXT NOT NULL, room_id TEXT NOT NULL, next_chunk_id TEXT NOT NULL, - UNIQUE (insertion_event_id, room_id, next_chunk_id) + UNIQUE (event_id, room_id, next_chunk_id) ); CREATE INDEX IF NOT EXISTS insertion_events_insertion_room_id ON insertion_events(room_id); -CREATE INDEX IF NOT EXISTS insertion_events_insertion_event_id ON insertion_events(insertion_event_id); +CREATE 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); CREATE TABLE IF NOT EXISTS insertion_event_edges( - insertion_event_id TEXT NOT NULL, + event_id TEXT NOT NULL, room_id TEXT NOT NULL, insertion_prev_event_id TEXT NOT NULL, - UNIQUE (insertion_event_id, room_id, insertion_prev_event_id) + UNIQUE (event_id, room_id, insertion_prev_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_insertion_event_id ON insertion_event_edges(insertion_event_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); CREATE TABLE IF NOT EXISTS chunk_edges(