ai-chatbot/lib/db/migrations/0078_add_dingtalk_notification_tasks.sql
Your Name 2561c66cb8
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
feat: update workflow categories and admin notifications
2026-05-07 19:31:14 +08:00

22 lines
797 B
SQL

CREATE TABLE IF NOT EXISTS "DingTalkNotificationTask" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"title" varchar(100) NOT NULL,
"content" text NOT NULL,
"status" varchar(24) NOT NULL DEFAULT 'pending',
"scheduledAt" timestamp NOT NULL,
"attempts" integer NOT NULL DEFAULT 0,
"lastAttemptAt" timestamp,
"sentAt" timestamp,
"cancelledAt" timestamp,
"lastError" text,
"createdBy" uuid REFERENCES "User"("id"),
"createdAt" timestamp NOT NULL DEFAULT now(),
"updatedAt" timestamp NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS "DingTalkNotificationTask_status_scheduledAt_idx"
ON "DingTalkNotificationTask" ("status", "scheduledAt");
CREATE INDEX IF NOT EXISTS "DingTalkNotificationTask_createdAt_idx"
ON "DingTalkNotificationTask" ("createdAt");