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,