diff --git a/migrations/20180425142932-user-add-twoFactorAuthenticationSecret.js b/migrations/20180425142932-user-add-twoFactorAuthenticationSecret.js new file mode 100644 index 000000000..cad45f9e9 --- /dev/null +++ b/migrations/20180425142932-user-add-twoFactorAuthenticationSecret.js @@ -0,0 +1,15 @@ +'use strict'; + +exports.up = function(db, callback) { + db.runSql('ALTER TABLE users ADD COLUMN twoFactorAuthenticationSecret VARCHAR(128) DEFAULT "", ADD COLUMN twoFactorAuthenticationEnabled BOOLEAN DEFAULT false', function (error) { + if (error) console.error(error); + callback(error); + }); +}; + +exports.down = function(db, callback) { + db.runSql('ALTER TABLE users DROP twoFactorAuthenticationSecret, DROP twoFactorAuthenticationEnabled', function (error) { + if (error) console.error(error); + callback(error); + }); +}; diff --git a/migrations/schema.sql b/migrations/schema.sql index 0cba7413b..e3f7b5096 100644 --- a/migrations/schema.sql +++ b/migrations/schema.sql @@ -22,8 +22,10 @@ CREATE TABLE IF NOT EXISTS users( createdAt VARCHAR(512) NOT NULL, modifiedAt VARCHAR(512) NOT NULL, admin INTEGER NOT NULL, - displayName VARCHAR(512) DEFAULT '', - fallbackEmail VARCHAR(512) DEFAULT "" + displayName VARCHAR(512) DEFAULT "", + fallbackEmail VARCHAR(512) DEFAULT "", + twoFactorAuthenticationSecret VARCHAR(128) DEFAULT "", + twoFactorAuthenticationEnabled BOOLEAN DEFAULT false, PRIMARY KEY(id));