"targetId" int NOT NULL,
"task" "jobType" NOT NULL,
"state" "jobState" NOT NULL DEFAULT 'open',
- "warning" smallint NOT NULL DEFAULT '0',
+ "attempt" smallint NOT NULL DEFAULT '0',
"executeFrom" DATE,
"executeTo" VARCHAR(11),
PRIMARY KEY ("id")
"version" smallint NOT NULL,
PRIMARY KEY ("version")
);
-INSERT INTO "schemeVersion" (version) VALUES(33);
+INSERT INTO "schemeVersion" (version) VALUES(34);
DROP TABLE IF EXISTS `passwordResetTickets`;
CREATE TABLE `passwordResetTickets` (
"content" text NOT NULL,
PRIMARY KEY ("certid", "type")
);
+
+DROP TABLE IF EXISTS "jobLog";
+CREATE TABLE "jobLog" (
+ "jobid" int NOT NULL,
+ "attempt" smallint NOT NULL,
+ "content" text NOT NULL,
+ PRIMARY KEY ("jobid", "attempt")
+);
+CREATE INDEX ON "jobLog" ("jobid");
--- /dev/null
+CREATE TABLE "jobLog" (
+ "jobid" int NOT NULL,
+ "attempt" smallint NOT NULL,
+ "content" text NOT NULL,
+ PRIMARY KEY ("jobid", "attempt")
+);
+CREATE INDEX ON "jobLog" ("jobid");
+
+ALTER TABLE "jobs" RENAME COLUMN "warning" TO "attempt";
"WHERE `certId`=?");
updateMail = new GigiPreparedStatement("UPDATE certs SET created=NOW(), serial=?, caid=?, expire=? WHERE id=?");
- warnMail = new GigiPreparedStatement("UPDATE jobs SET warning=warning+1, state=CASE WHEN warning<3 THEN 'open'::`jobState` ELSE 'error'::`jobState` END WHERE id=?");
+ warnMail = new GigiPreparedStatement("UPDATE jobs SET attempt=attempt+1, state=CASE WHEN attempt<3 THEN 'open'::`jobState` ELSE 'error'::`jobState` END WHERE id=?");
revoke = new GigiPreparedStatement("SELECT certs.id, jobs.id FROM jobs INNER JOIN certs ON jobs.`targetId`=certs.id" + " WHERE jobs.state='open' AND task='revoke'");
revokeCompleted = new GigiPreparedStatement("UPDATE `certs` SET revoked=NOW() WHERE id=?");