summaryrefslogtreecommitdiff
path: root/query
diff options
context:
space:
mode:
Diffstat (limited to 'query')
-rw-r--r--query/frequencies.sql4
-rw-r--r--query/networks.sql14
2 files changed, 9 insertions, 9 deletions
diff --git a/query/frequencies.sql b/query/frequencies.sql
index 6e67c24..464f371 100644
--- a/query/frequencies.sql
+++ b/query/frequencies.sql
@@ -12,7 +12,7 @@ INSERT INTO frequencies (
name, hex_color,
perms, position
) VALUES (
- ?, @network_id, ?, ?, ?,
+ @id, @network_id, @name, @hex_color, @perms,
(SELECT COUNT(*) FROM frequencies WHERE network_id = @network_id)
)
RETURNING *;
@@ -23,7 +23,7 @@ UPDATE frequencies SET
WHEN position = @pos1 THEN @pos2
WHEN position = @pos2 THEN @pos1
END
-WHERE network_id = ? AND position IN (@pos1, @pos2);
+WHERE network_id = @network_id AND position IN (@pos1, @pos2);
-- name: SetFrequencyName :one
UPDATE frequencies SET
diff --git a/query/networks.sql b/query/networks.sql
index 0b0303f..b2720b7 100644
--- a/query/networks.sql
+++ b/query/networks.sql
@@ -11,7 +11,7 @@ INSERT INTO networks (
id, owner_id, name, is_public,
icon, bg_hex_color, fg_hex_color
) VALUES (
- ?, ?, ?, ?,
+ ?, ?, ?, ?,
?, ?, ?
)
RETURNING *;
@@ -69,13 +69,13 @@ INSERT INTO users_networks (
is_member, is_admin, is_muted,
is_banned, ban_reason
) VALUES (
- ?, ?,
- ?, ?, ?,
- ?, ?
+ ?1, ?2,
+ ?3, ?4, ?5,
+ ?6, ?7
)
ON CONFLICT DO
UPDATE SET
- is_member = ?, is_admin = ?, is_muted = ?,
- is_banned = ?, ban_reason = ?
-WHERE user_id = ? AND network_id = ?
+ is_member = ?3, is_admin = ?4, is_muted = ?5,
+ is_banned = ?6, ban_reason = ?7
+WHERE user_id = ?1 AND network_id = ?2
RETURNING *;