Update upgrade script
This commit is contained in:
parent
882dc8dcab
commit
35f4f6b070
|
@ -31,6 +31,7 @@ delta_sql = """
|
||||||
CREATE TABLE IF NOT EXISTS event_json(
|
CREATE TABLE IF NOT EXISTS event_json(
|
||||||
event_id TEXT NOT NULL,
|
event_id TEXT NOT NULL,
|
||||||
room_id TEXT NOT NULL,
|
room_id TEXT NOT NULL,
|
||||||
|
internal_metadata NOT NULL,
|
||||||
json BLOB NOT NULL,
|
json BLOB NOT NULL,
|
||||||
CONSTRAINT ev_j_uniq UNIQUE (event_id)
|
CONSTRAINT ev_j_uniq UNIQUE (event_id)
|
||||||
);
|
);
|
||||||
|
@ -79,7 +80,7 @@ class Store(object):
|
||||||
|
|
||||||
d.setdefault("unsigned", {})["age_ts"] = d.pop("age_ts")
|
d.setdefault("unsigned", {})["age_ts"] = d.pop("age_ts")
|
||||||
|
|
||||||
d.pop("outlier", None)
|
outlier = d.pop("outlier", False)
|
||||||
|
|
||||||
# d.pop("membership", None)
|
# d.pop("membership", None)
|
||||||
|
|
||||||
|
@ -87,7 +88,10 @@ class Store(object):
|
||||||
|
|
||||||
d.pop("replaces_state", None)
|
d.pop("replaces_state", None)
|
||||||
|
|
||||||
events.append(EventBuilder(d))
|
b = EventBuilder(d)
|
||||||
|
b.internal_metadata.outlier = outlier
|
||||||
|
|
||||||
|
events.append(b)
|
||||||
|
|
||||||
for i, ev in enumerate(events):
|
for i, ev in enumerate(events):
|
||||||
signatures = self._get_event_signatures_txn(
|
signatures = self._get_event_signatures_txn(
|
||||||
|
@ -251,12 +255,17 @@ def reinsert_events(cursor, server_name, signing_key):
|
||||||
event.get_dict()
|
event.get_dict()
|
||||||
).decode("UTF-8")
|
).decode("UTF-8")
|
||||||
|
|
||||||
|
metadata_json = encode_canonical_json(
|
||||||
|
event.internal_metadata.get_dict()
|
||||||
|
).decode("UTF-8")
|
||||||
|
|
||||||
store._simple_insert_txn(
|
store._simple_insert_txn(
|
||||||
cursor,
|
cursor,
|
||||||
table="event_json",
|
table="event_json",
|
||||||
values={
|
values={
|
||||||
"event_id": event.event_id,
|
"event_id": event.event_id,
|
||||||
"room_id": event.room_id,
|
"room_id": event.room_id,
|
||||||
|
"internal_metadata": metadata_json,
|
||||||
"json": event_json,
|
"json": event_json,
|
||||||
},
|
},
|
||||||
or_replace=True,
|
or_replace=True,
|
||||||
|
|
Loading…
Reference in New Issue