From eb1184b284ea37cc31556e3598916ac9c3fa6939 Mon Sep 17 00:00:00 2001
From: Niall Sheridan <nsheridan@gmail.com>
Date: Thu, 23 Aug 2018 22:29:46 +0100
Subject: Record request reason in the db instead of logging

---
 .../migrations/sqlite3/20180822204521_add_reason.sql   | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 server/store/migrations/sqlite3/20180822204521_add_reason.sql

(limited to 'server/store/migrations/sqlite3/20180822204521_add_reason.sql')

diff --git a/server/store/migrations/sqlite3/20180822204521_add_reason.sql b/server/store/migrations/sqlite3/20180822204521_add_reason.sql
new file mode 100644
index 0000000..07e9d49
--- /dev/null
+++ b/server/store/migrations/sqlite3/20180822204521_add_reason.sql
@@ -0,0 +1,18 @@
+-- +migrate Up
+ALTER TABLE `issued_certs` ADD COLUMN `message` TEXT NOT NULL DEFAULT "";
+
+-- +migrate Down
+CREATE TABLE `issued_certs_new` (
+  `id` INTEGER PRIMARY KEY,
+  `key_id` varchar(255) UNIQUE NOT NULL,
+  `principals` varchar(255) DEFAULT '[]',
+  `created_at` datetime DEFAULT '1970-01-01 00:00:01',
+  `expires_at` datetime DEFAULT '1970-01-01 00:00:01',
+  `revoked` tinyint(1) DEFAULT '0',
+  `raw_key` text
+);
+INSERT INTO `issued_certs_new` (key_id, principals, created_at, expires_at, revoked, raw_key)
+  SELECT key_id, principals, created_at, expires_at, revoked, raw_key FROM `issued_certs`;
+DROP TABLE `issued_certs`;
+ALTER TABLE `issued_certs_new` RENAME TO `issued_certs`;
+CREATE INDEX `idx_expires_at` ON `issued_certs` (`expires_at`);
\ No newline at end of file
-- 
cgit v1.2.3

