Refactor with registry.

This commit is contained in:
2025-09-03 23:43:12 +10:00
parent 26f29e6de7
commit fda6847671
7 changed files with 127 additions and 49 deletions

View File

@@ -0,0 +1,20 @@
BEGIN;
-- Koan data {{{
INSERT INTO version_history (component, from_version, to_version, author)
VALUES ('KOANS', 0, 1, 'Initial Creation');
---- !koans lists koans. !koan gives a random koan. !koans add name ... !koans del name ...
CREATE TABLE koans(
koanid INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
communityid INTEGER NOT NULL REFERENCES communities ON UPDATE CASCADE ON DELETE CASCADE,
name TEXT NOT NULL,
message TEXT NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
_timestamp TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE TRIGGER koans_timestamp BEFORE UPDATE ON koans
FOR EACH ROW EXECUTE FUNCTION update_timestamp_column();
-- }}}
COMMIT;