From 92bfc0f84ea02e71624786b4df36f2d089a8a8cf Mon Sep 17 00:00:00 2001 From: Daniel Ponte Date: Sun, 21 Jul 2024 10:46:51 -0400 Subject: [PATCH] Fix schema --- sql/postgres/migrations/001_initial.up.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sql/postgres/migrations/001_initial.up.sql b/sql/postgres/migrations/001_initial.up.sql index 3eca0e0..c601fb8 100644 --- a/sql/postgres/migrations/001_initial.up.sql +++ b/sql/postgres/migrations/001_initial.up.sql @@ -32,7 +32,7 @@ CREATE TABLE IF NOT EXISTS talkgroups( frequency INTEGER, auto_created BOOLEAN, metadata JSONB, - PRIMARY KEY (tgid, system) + PRIMARY KEY (system_id, tgid) ); CREATE TABLE IF NOT EXISTS talkgroups_tags( @@ -64,7 +64,7 @@ CREATE TABLE IF NOT EXISTS calls( CREATE INDEX IF NOT EXISTS calls_transcript_idx ON calls USING GIN (to_tsvector('english', transcript)); -CREATE INDEX IF NOT EXISTS calls_date_tg_idx ON calls(talkgroup, date); +CREATE INDEX IF NOT EXISTS calls_call_date_tg_idx ON calls(talkgroup, call_date); CREATE TABLE IF NOT EXISTS settings( name TEXT PRIMARY KEY, @@ -82,7 +82,7 @@ CREATE TABLE IF NOT EXISTS incidents( metadata JSONB ); -CREATE INDEX IF NOT EXISTS calls_name_description_idx ON calls USING GIN ( +CREATE INDEX IF NOT EXISTS incidents_name_description_idx ON incidents USING GIN ( (to_tsvector('english', name) || to_tsvector('english', coalesce(description, '')) ) );