mirror of
https://mau.dev/maunium/synapse.git
synced 2024-09-02 23:52:00 +00:00
![Richard van der Hoff](/assets/img/avatar_default.png)
The hope here is that by moving all the schema files into synapse/storage/schema, it gets a bit easier for newcomers to navigate. It certainly got easier for me to write a helpful README. There's more to do on that front, but I'll follow up with other PRs for that.
20 lines
546 B
SQL
20 lines
546 B
SQL
CREATE TABLE IF NOT EXISTS user_threepids2 (
|
|
user_id TEXT NOT NULL,
|
|
medium TEXT NOT NULL,
|
|
address TEXT NOT NULL,
|
|
validated_at BIGINT NOT NULL,
|
|
added_at BIGINT NOT NULL,
|
|
CONSTRAINT medium_address UNIQUE (medium, address)
|
|
);
|
|
|
|
INSERT INTO user_threepids2
|
|
SELECT * FROM user_threepids WHERE added_at IN (
|
|
SELECT max(added_at) FROM user_threepids GROUP BY medium, address
|
|
)
|
|
;
|
|
|
|
DROP TABLE user_threepids;
|
|
ALTER TABLE user_threepids2 RENAME TO user_threepids;
|
|
|
|
CREATE INDEX user_threepids_user_id ON user_threepids(user_id);
|