aboutsummaryrefslogtreecommitdiff
path: root/schema.sql
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2020-06-27 22:16:53 +0200
committerTom Smeding <tom.smeding@gmail.com>2020-06-27 22:26:59 +0200
commit5704a49c7908cef401d23879f32013f90d2e7878 (patch)
treea87a5c5637701ebf575a86825b15f010801784c9 /schema.sql
parente86deffd9c387f0912eb392cf23cb08aa3ea4c1e (diff)
server: Ensure db queries are all indexed
Diffstat (limited to 'schema.sql')
-rw-r--r--schema.sql3
1 files changed, 2 insertions, 1 deletions
diff --git a/schema.sql b/schema.sql
index 06baafd..15d274c 100644
--- a/schema.sql
+++ b/schema.sql
@@ -17,6 +17,7 @@ create table Members (
foreign key(room) references Rooms(id) on delete cascade,
foreign key(user) references Users(id) on delete cascade
);
+create index members_user_index on Members(user);
create table Users (
id integer primary key not null,
@@ -34,7 +35,7 @@ create table Messages (
foreign key(room) references Rooms(id) on delete cascade,
foreign key(user) references Users(id) on delete set null
);
-create index messages_time_index on Messages(time);
+create index messages_time_index on Messages(room, time desc);
create table Firebase (
user integer not null,