1CREATE TABLE IF NOT EXISTS "followers" (
2 "id" SERIAL PRIMARY KEY,
3 "room_id" INTEGER NOT NULL REFERENCES rooms (id) ON DELETE CASCADE,
4 "project_id" INTEGER NOT NULL REFERENCES projects (id) ON DELETE CASCADE,
5 "leader_connection_server_id" INTEGER NOT NULL REFERENCES servers (id) ON DELETE CASCADE,
6 "leader_connection_id" INTEGER NOT NULL,
7 "follower_connection_server_id" INTEGER NOT NULL REFERENCES servers (id) ON DELETE CASCADE,
8 "follower_connection_id" INTEGER NOT NULL
9);
10
11CREATE UNIQUE INDEX
12 "index_followers_on_project_id_and_leader_connection_server_id_and_leader_connection_id_and_follower_connection_server_id_and_follower_connection_id"
13ON "followers" ("project_id", "leader_connection_server_id", "leader_connection_id", "follower_connection_server_id", "follower_connection_id");
14
15CREATE INDEX "index_followers_on_room_id" ON "followers" ("room_id");