api shell

This commit is contained in:
Jason Ross
2026-03-22 12:57:16 -05:00
parent 2910468199
commit 7dfada7690
10 changed files with 235 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
-- Atomic sequence increment for message ordering
CREATE OR REPLACE FUNCTION next_message_sequence(conv_id UUID)
RETURNS BIGINT AS $$
DECLARE
seq BIGINT;
BEGIN
UPDATE conversations
SET next_sequence = next_sequence + 1, updated_at = now()
WHERE id = conv_id
RETURNING next_sequence INTO seq;
RETURN seq;
END;
$$ LANGUAGE plpgsql;