]> WPIA git - gigi.git/blobdiff - src/club/wpia/gigi/database/tableStructure.sql
add: table to store certificate logs
[gigi.git] / src / club / wpia / gigi / database / tableStructure.sql
index 57825338bdf2180fd67ec1d0a287f1c42b2e076f..440bdec788db8fee8de4e8c532dd4b6e439dd97f 100644 (file)
@@ -137,9 +137,11 @@ CREATE TABLE "user_agreements" (
 );
 
 DROP TABLE IF EXISTS "certs";
+DROP TYPE IF EXISTS "revocationType";
+CREATE TYPE "revocationType" AS ENUM('user', 'support', 'ping_timeout', 'key_compromise');
 
 DROP TYPE IF EXISTS "mdType";
-CREATE TYPE "mdType" AS ENUM('md5','sha1','sha256','sha512');
+CREATE TYPE "mdType" AS ENUM('md5','sha1','sha256','sha384','sha512');
 
 DROP TYPE IF EXISTS "csrType";
 CREATE TYPE "csrType" AS ENUM ('CSR', 'SPKAC');
@@ -154,12 +156,16 @@ CREATE TABLE "certs" (
   "profile" int NOT NULL,
   "caid" int NULL DEFAULT NULL,
 
-  "csr_name" varchar(255) NOT NULL DEFAULT '',
   "csr_type" "csrType" NOT NULL,
-  "crt_name" varchar(255) NOT NULL DEFAULT '',
   "created" timestamp NULL DEFAULT NULL,
   "modified" timestamp NULL DEFAULT NULL,
-  "revoked" timestamp NULL DEFAULT NULL,
+
+  "revoked" timestamp NULL,
+  "revocationType" "revocationType" NULL,
+  "revocationChallenge" varchar(32) NULL DEFAULT NULL,
+  "revocationSignature" text NULL DEFAULT NULL,
+  "revocationMessage" text NULL DEFAULT NULL,
+
   "expire" timestamp NULL DEFAULT NULL,
   "renewed" boolean NOT NULL DEFAULT 'false',
   "pkhash" char(40) DEFAULT NULL,
@@ -173,9 +179,6 @@ CREATE INDEX ON "certs" ("created");
 CREATE INDEX ON "certs" ("memid");
 CREATE INDEX ON "certs" ("serial");
 CREATE INDEX ON "certs" ("expire");
-CREATE INDEX ON "certs" ("crt_name");
-
-
 
 DROP TABLE IF EXISTS "certAvas";
 CREATE TABLE "certAvas" (
@@ -240,7 +243,7 @@ CREATE TABLE "jobs" (
   "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")
@@ -375,7 +378,7 @@ CREATE TABLE "schemeVersion" (
   "version" smallint NOT NULL,
   PRIMARY KEY ("version")
 );
-INSERT INTO "schemeVersion" (version)  VALUES(27);
+INSERT INTO "schemeVersion" (version)  VALUES(34);
 
 DROP TABLE IF EXISTS `passwordResetTickets`;
 CREATE TABLE `passwordResetTickets` (
@@ -680,3 +683,24 @@ CREATE TABLE "nameParts" (
   "type" "namePartType" NOT NULL,
   "value" varchar(255) NOT NULL
 );
+
+
+DROP TABLE IF EXISTS "certificateAttachment";
+DROP TYPE IF EXISTS "certificateAttachmentType";
+CREATE TYPE "certificateAttachmentType" AS ENUM ('CSR','CRT');
+
+CREATE TABLE "certificateAttachment" (
+  "certid" int NOT NULL,
+  "type" "certificateAttachmentType" NOT NULL,
+  "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");