Learned has uuids
This commit is contained in:
parent
9faecccf2a
commit
4eddd7d1df
5 changed files with 14 additions and 14 deletions
|
@ -98,7 +98,7 @@ type Talkgroup struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type TalkgroupsLearned struct {
|
type TalkgroupsLearned struct {
|
||||||
ID int32 `json:"id"`
|
ID uuid.UUID `json:"id"`
|
||||||
SystemID int `json:"system_id"`
|
SystemID int `json:"system_id"`
|
||||||
TGID int `json:"tgid"`
|
TGID int `json:"tgid"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
|
|
@ -34,7 +34,7 @@ JOIN systems sys ON tg.system_id = sys.id
|
||||||
JOIN UNNEST($1::INT4[], $2::INT4[]) AS tgt(sys, tg) ON (tg.system_id = tgt.sys AND tg.tgid = tgt.tg)
|
JOIN UNNEST($1::INT4[], $2::INT4[]) AS tgt(sys, tg) ON (tg.system_id = tgt.sys AND tg.tgid = tgt.tg)
|
||||||
UNION
|
UNION
|
||||||
SELECT
|
SELECT
|
||||||
NULL::UUID, tgl.system_id::INT4, tgl.tgid::INT4, tgl.name,
|
tgl.id, tgl.system_id::INT4, tgl.tgid::INT4, tgl.name,
|
||||||
tgl.alpha_tag, tgl.alpha_tag, NULL::INTEGER, NULL::JSONB,
|
tgl.alpha_tag, tgl.alpha_tag, NULL::INTEGER, NULL::JSONB,
|
||||||
CASE WHEN tgl.alpha_tag IS NULL THEN NULL ELSE ARRAY[tgl.alpha_tag] END,
|
CASE WHEN tgl.alpha_tag IS NULL THEN NULL ELSE ARRAY[tgl.alpha_tag] END,
|
||||||
TRUE, NULL::JSONB, 1.0, sys.id, sys.name,
|
TRUE, NULL::JSONB, 1.0, sys.id, sys.name,
|
||||||
|
|
|
@ -106,7 +106,7 @@ JOIN systems sys ON tg.system_id = sys.id
|
||||||
WHERE (tg.system_id, tg.tgid) = ($1, $2)
|
WHERE (tg.system_id, tg.tgid) = ($1, $2)
|
||||||
UNION
|
UNION
|
||||||
SELECT
|
SELECT
|
||||||
NULL::UUID, tgl.system_id::INT4, tgl.tgid::INT4, tgl.name,
|
tgl.id, tgl.system_id::INT4, tgl.tgid::INT4, tgl.name,
|
||||||
tgl.alpha_tag, tgl.alpha_tag, NULL::INTEGER, NULL::JSONB,
|
tgl.alpha_tag, tgl.alpha_tag, NULL::INTEGER, NULL::JSONB,
|
||||||
CASE WHEN tgl.alpha_tag IS NULL THEN NULL ELSE ARRAY[tgl.alpha_tag] END,
|
CASE WHEN tgl.alpha_tag IS NULL THEN NULL ELSE ARRAY[tgl.alpha_tag] END,
|
||||||
TRUE, NULL::JSONB, 1.0, sys.id, sys.name,
|
TRUE, NULL::JSONB, 1.0, sys.id, sys.name,
|
||||||
|
@ -237,7 +237,7 @@ FROM talkgroups tg
|
||||||
JOIN systems sys ON tg.system_id = sys.id
|
JOIN systems sys ON tg.system_id = sys.id
|
||||||
UNION
|
UNION
|
||||||
SELECT
|
SELECT
|
||||||
NULL::UUID, tgl.system_id::INT4, tgl.tgid::INT4, tgl.name,
|
tgl.id, tgl.system_id::INT4, tgl.tgid::INT4, tgl.name,
|
||||||
tgl.alpha_tag, tgl.alpha_tag, NULL::INTEGER, NULL::JSONB,
|
tgl.alpha_tag, tgl.alpha_tag, NULL::INTEGER, NULL::JSONB,
|
||||||
CASE WHEN tgl.alpha_tag IS NULL THEN NULL ELSE ARRAY[tgl.alpha_tag] END,
|
CASE WHEN tgl.alpha_tag IS NULL THEN NULL ELSE ARRAY[tgl.alpha_tag] END,
|
||||||
TRUE, NULL::JSONB, 1.0, sys.id, sys.name,
|
TRUE, NULL::JSONB, 1.0, sys.id, sys.name,
|
||||||
|
@ -298,7 +298,7 @@ JOIN systems sys ON tg.system_id = sys.id
|
||||||
WHERE tg.system_id = $1
|
WHERE tg.system_id = $1
|
||||||
UNION
|
UNION
|
||||||
SELECT
|
SELECT
|
||||||
NULL::UUID, tgl.system_id::INT4, tgl.tgid::INT4, tgl.name,
|
tgl.id, tgl.system_id::INT4, tgl.tgid::INT4, tgl.name,
|
||||||
tgl.alpha_tag, tgl.alpha_tag, NULL::INTEGER, NULL::JSONB,
|
tgl.alpha_tag, tgl.alpha_tag, NULL::INTEGER, NULL::JSONB,
|
||||||
CASE WHEN tgl.alpha_tag IS NULL THEN NULL ELSE ARRAY[tgl.alpha_tag] END,
|
CASE WHEN tgl.alpha_tag IS NULL THEN NULL ELSE ARRAY[tgl.alpha_tag] END,
|
||||||
TRUE, NULL::JSONB, 1.0, sys.id, sys.name,
|
TRUE, NULL::JSONB, 1.0, sys.id, sys.name,
|
||||||
|
|
|
@ -44,7 +44,7 @@ CREATE INDEX talkgroups_system_tgid_idx ON talkgroups (system_id, tgid);
|
||||||
CREATE INDEX IF NOT EXISTS talkgroup_id_tags ON talkgroups USING GIN (tags);
|
CREATE INDEX IF NOT EXISTS talkgroup_id_tags ON talkgroups USING GIN (tags);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS talkgroups_learned(
|
CREATE TABLE IF NOT EXISTS talkgroups_learned(
|
||||||
id SERIAL PRIMARY KEY,
|
id UUID PRIMARY KEY,
|
||||||
system_id INTEGER REFERENCES systems(id) NOT NULL,
|
system_id INTEGER REFERENCES systems(id) NOT NULL,
|
||||||
tgid INTEGER NOT NULL,
|
tgid INTEGER NOT NULL,
|
||||||
name TEXT NOT NULL,
|
name TEXT NOT NULL,
|
||||||
|
|
|
@ -33,7 +33,7 @@ JOIN systems sys ON tg.system_id = sys.id
|
||||||
WHERE (tg.system_id, tg.tgid) = (@system_id, @tgid)
|
WHERE (tg.system_id, tg.tgid) = (@system_id, @tgid)
|
||||||
UNION
|
UNION
|
||||||
SELECT
|
SELECT
|
||||||
NULL::UUID, tgl.system_id::INT4, tgl.tgid::INT4, tgl.name,
|
tgl.id, tgl.system_id::INT4, tgl.tgid::INT4, tgl.name,
|
||||||
tgl.alpha_tag, tgl.alpha_tag, NULL::INTEGER, NULL::JSONB,
|
tgl.alpha_tag, tgl.alpha_tag, NULL::INTEGER, NULL::JSONB,
|
||||||
CASE WHEN tgl.alpha_tag IS NULL THEN NULL ELSE ARRAY[tgl.alpha_tag] END,
|
CASE WHEN tgl.alpha_tag IS NULL THEN NULL ELSE ARRAY[tgl.alpha_tag] END,
|
||||||
TRUE, NULL::JSONB, 1.0, sys.id, sys.name,
|
TRUE, NULL::JSONB, 1.0, sys.id, sys.name,
|
||||||
|
@ -51,7 +51,7 @@ JOIN systems sys ON tg.system_id = sys.id
|
||||||
WHERE tg.system_id = @system
|
WHERE tg.system_id = @system
|
||||||
UNION
|
UNION
|
||||||
SELECT
|
SELECT
|
||||||
NULL::UUID, tgl.system_id::INT4, tgl.tgid::INT4, tgl.name,
|
tgl.id, tgl.system_id::INT4, tgl.tgid::INT4, tgl.name,
|
||||||
tgl.alpha_tag, tgl.alpha_tag, NULL::INTEGER, NULL::JSONB,
|
tgl.alpha_tag, tgl.alpha_tag, NULL::INTEGER, NULL::JSONB,
|
||||||
CASE WHEN tgl.alpha_tag IS NULL THEN NULL ELSE ARRAY[tgl.alpha_tag] END,
|
CASE WHEN tgl.alpha_tag IS NULL THEN NULL ELSE ARRAY[tgl.alpha_tag] END,
|
||||||
TRUE, NULL::JSONB, 1.0, sys.id, sys.name,
|
TRUE, NULL::JSONB, 1.0, sys.id, sys.name,
|
||||||
|
@ -68,7 +68,7 @@ FROM talkgroups tg
|
||||||
JOIN systems sys ON tg.system_id = sys.id
|
JOIN systems sys ON tg.system_id = sys.id
|
||||||
UNION
|
UNION
|
||||||
SELECT
|
SELECT
|
||||||
NULL::UUID, tgl.system_id::INT4, tgl.tgid::INT4, tgl.name,
|
tgl.id, tgl.system_id::INT4, tgl.tgid::INT4, tgl.name,
|
||||||
tgl.alpha_tag, tgl.alpha_tag, NULL::INTEGER, NULL::JSONB,
|
tgl.alpha_tag, tgl.alpha_tag, NULL::INTEGER, NULL::JSONB,
|
||||||
CASE WHEN tgl.alpha_tag IS NULL THEN NULL ELSE ARRAY[tgl.alpha_tag] END,
|
CASE WHEN tgl.alpha_tag IS NULL THEN NULL ELSE ARRAY[tgl.alpha_tag] END,
|
||||||
TRUE, NULL::JSONB, 1.0, sys.id, sys.name,
|
TRUE, NULL::JSONB, 1.0, sys.id, sys.name,
|
||||||
|
|
Loading…
Reference in a new issue