22 lines
797 B
SQL
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");
|