From 58d8f688e530132d2a2d149ea23d7ae29e39bb94 Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Thu, 6 Feb 2020 11:11:15 +0100 Subject: [PATCH] Update schema since authcodes is gone --- .../20200205172146-remove-authcodedb.js | 22 +++++++++++++++++++ migrations/schema.sql | 7 ------ 2 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 migrations/20200205172146-remove-authcodedb.js diff --git a/migrations/20200205172146-remove-authcodedb.js b/migrations/20200205172146-remove-authcodedb.js new file mode 100644 index 000000000..15690425e --- /dev/null +++ b/migrations/20200205172146-remove-authcodedb.js @@ -0,0 +1,22 @@ +'use strict'; + +exports.up = function(db, callback) { + db.runSql('DROP TABLE authcodes', function (error) { + if (error) console.error(error); + callback(error); + }); +}; + +exports.down = function(db, callback) { + var cmd = `CREATE TABLE IF NOT EXISTS authcodes( + authCode VARCHAR(128) NOT NULL UNIQUE, + userId VARCHAR(128) NOT NULL, + clientId VARCHAR(128) NOT NULL, + expiresAt BIGINT NOT NULL, + PRIMARY KEY(authCode)) CHARACTER SET utf8 COLLATE utf8_bin`; + + db.runSql(cmd, function (error) { + if (error) console.error(error); + callback(error); + }); +}; diff --git a/migrations/schema.sql b/migrations/schema.sql index edd1cecc2..c79948f6b 100644 --- a/migrations/schema.sql +++ b/migrations/schema.sql @@ -105,13 +105,6 @@ CREATE TABLE IF NOT EXISTS appPortBindings( FOREIGN KEY(appId) REFERENCES apps(id), PRIMARY KEY(hostPort)); -CREATE TABLE IF NOT EXISTS authcodes( - authCode VARCHAR(128) NOT NULL UNIQUE, - userId VARCHAR(128) NOT NULL, - clientId VARCHAR(128) NOT NULL, - expiresAt BIGINT NOT NULL, // ## FIXME: make this a timestamp - PRIMARY KEY(authCode)); - CREATE TABLE IF NOT EXISTS settings( name VARCHAR(128) NOT NULL UNIQUE, value TEXT,