Tickets: settings, category edit and ticket list from Discord; NOTIFY triggers in schema.sql
- /tickets settings (on or off, panel title and text, open tickets per member), /tickets category edit, /tickets list - schema.sql now creates the NOTIFY triggers, so the integration tests run on a database built from it, and two stale expectations (tickets start off) are fixed Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
1 parent
d95ebf473e
commit
acdb5ead35
6 files changed
+483
-20
No files matched your search
+34
@@ -445,3 +445,37 @@ CREATE TABLE IF NOT EXISTS security_commands (
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
processed_at TIMESTAMPTZ
|
||||
);
|
||||
|
||||
-- Wake the bot when a request is added. The bot also processes everything
|
||||
-- waiting when it starts, so a request is never lost; this only makes it
|
||||
-- immediate. Whatever writes to these tables (a dashboard, a script) needs no
|
||||
-- NOTIFY of its own.
|
||||
CREATE OR REPLACE FUNCTION notify_music_command() RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
PERFORM pg_notify('music_commands', NEW.id::text);
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
DROP TRIGGER IF EXISTS music_commands_notify ON music_commands;
|
||||
CREATE TRIGGER music_commands_notify AFTER INSERT ON music_commands
|
||||
FOR EACH ROW EXECUTE FUNCTION notify_music_command();
|
||||
|
||||
CREATE OR REPLACE FUNCTION notify_ticket_command() RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
PERFORM pg_notify('ticket_commands', NEW.id::text);
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
DROP TRIGGER IF EXISTS ticket_commands_notify ON ticket_commands;
|
||||
CREATE TRIGGER ticket_commands_notify AFTER INSERT ON ticket_commands
|
||||
FOR EACH ROW EXECUTE FUNCTION notify_ticket_command();
|
||||
|
||||
CREATE OR REPLACE FUNCTION notify_security_command() RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
PERFORM pg_notify('security_commands', NEW.id::text);
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
DROP TRIGGER IF EXISTS security_commands_notify ON security_commands;
|
||||
CREATE TRIGGER security_commands_notify AFTER INSERT ON security_commands
|
||||
FOR EACH ROW EXECUTE FUNCTION notify_security_command();
|
||||
Reference in new issue
Block a user