forked-synapse/synapse/storage/data_stores/main/schema/delta/16/remove_duplicates.sql
Erik Johnston c66a06ac6b Move storage classes into a main "data store".
This is in preparation for having multiple data stores that offer
different functionality, e.g. splitting out state or event storage.
2019-10-21 16:05:06 +01:00

10 lines
265 B
SQL

DELETE FROM event_to_state_groups WHERE state_group not in (
SELECT MAX(state_group) FROM event_to_state_groups GROUP BY event_id
);
DELETE FROM event_to_state_groups WHERE rowid not in (
SELECT MIN(rowid) FROM event_to_state_groups GROUP BY event_id
);