Actually save things! Yay!
This commit is contained in:
15
migrations/20230319165242_facts.up.sql
Normal file
15
migrations/20230319165242_facts.up.sql
Normal file
@@ -0,0 +1,15 @@
|
||||
CREATE TABLE IF NOT EXISTS "facts" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
"channel_id" text,
|
||||
"author_id" text NOT NULL,
|
||||
"last_interaction_id" text NOT NULL,
|
||||
"name" text NOT NULL,
|
||||
"value" text NOT NULL,
|
||||
"expiration" interval NULL,
|
||||
"version" int NOT NULL DEFAULT 0,
|
||||
"created_at" timestamptz NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" timestamptz NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT facts_origin_key UNIQUE NULLS NOT DISTINCT ("channel_id", "author_id", "name")
|
||||
);
|
||||
CREATE TRIGGER "set_facts_updated" BEFORE
|
||||
UPDATE ON "facts" FOR EACH ROW EXECUTE PROCEDURE set_updated_timestamp();
|
||||
Reference in New Issue
Block a user