mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-01-26 09:05:56 -05:00
Add unique index to room_aliases, remove duplicates on upgrade. Convert some columns back to TEXT from bytea
This commit is contained in:
parent
e1c0970c11
commit
0ec346d942
3
synapse/storage/schema/delta/16/room_alias_index.sql
Normal file
3
synapse/storage/schema/delta/16/room_alias_index.sql
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
CREATE INDEX IF NOT EXISTS room_aliases_id ON room_aliases(room_id);
|
||||
CREATE INDEX IF NOT EXISTS room_alias_servers_alias ON room_alias_servers(room_alias);
|
@ -70,3 +70,11 @@ DROP INDEX IF EXISTS presence_list_observers;
|
||||
CREATE UNIQUE INDEX presence_list_observers ON presence_list(
|
||||
user_id, observed_user_id
|
||||
);
|
||||
|
||||
--
|
||||
DELETE FROM room_aliases WHERE rowid not in (
|
||||
SELECT MIN(rowid) FROM room_aliases GROUP BY room_alias
|
||||
);
|
||||
|
||||
DROP INDEX IF EXISTS room_aliases_id;
|
||||
CREATE INDEX room_aliases_id ON room_aliases(room_id);
|
||||
|
@ -33,7 +33,7 @@ CREATE TABLE IF NOT EXISTS sent_transactions(
|
||||
transaction_id VARCHAR(150),
|
||||
destination VARCHAR(150),
|
||||
response_code INTEGER DEFAULT 0,
|
||||
response_json bytea,
|
||||
response_json TEXT,
|
||||
ts BIGINT
|
||||
);
|
||||
|
||||
|
@ -35,7 +35,7 @@ CREATE TABLE IF NOT EXISTS user_ips (
|
||||
access_token VARCHAR(150) NOT NULL,
|
||||
device_id VARCHAR(150),
|
||||
ip VARCHAR(150) NOT NULL,
|
||||
user_agent VARCHAR(150) NOT NULL,
|
||||
user_agent TEXT NOT NULL,
|
||||
last_seen BIGINT NOT NULL,
|
||||
UNIQUE (user, access_token, ip, user_agent)
|
||||
);
|
||||
|
@ -19,7 +19,11 @@ CREATE TABLE IF NOT EXISTS room_aliases(
|
||||
UNIQUE (room_alias)
|
||||
);
|
||||
|
||||
CREATE INDEX room_aliases_id ON room_aliases(room_id);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS room_alias_servers(
|
||||
room_alias VARCHAR(150) NOT NULL,
|
||||
server VARCHAR(150) NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX room_alias_servers_alias ON room_alias_servers(room_alias);
|
||||
|
@ -33,7 +33,7 @@ CREATE TABLE IF NOT EXISTS sent_transactions(
|
||||
transaction_id VARCHAR(150),
|
||||
destination VARCHAR(150),
|
||||
response_code INTEGER DEFAULT 0,
|
||||
response_json bytea,
|
||||
response_json TEXT,
|
||||
ts BIGINT
|
||||
);
|
||||
|
||||
|
@ -34,7 +34,7 @@ CREATE TABLE IF NOT EXISTS user_ips (
|
||||
access_token VARCHAR(150) NOT NULL,
|
||||
device_id VARCHAR(150),
|
||||
ip VARCHAR(150) NOT NULL,
|
||||
user_agent VARCHAR(150) NOT NULL,
|
||||
user_agent TEXT NOT NULL,
|
||||
last_seen BIGINT NOT NULL
|
||||
);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user