summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorCheng-Han, Wu2016-05-15 12:20:42 +0800
committerCheng-Han, Wu2016-05-15 12:20:42 +0800
commitbaa946968d0b5204c0b7507d10eba95ee643fe4b (patch)
tree2c6fc193cb6284b45e2527d7a51ed99d80480412 /lib
parent93c6205aa62e06ed1fcdb1d54fa240b8008786f1 (diff)
Add db migrations for PR #121
Diffstat (limited to '')
-rw-r--r--lib/migrations/20160515114000-user-add-tokens.js15
-rw-r--r--lib/models/user.js3
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/migrations/20160515114000-user-add-tokens.js b/lib/migrations/20160515114000-user-add-tokens.js
new file mode 100644
index 00000000..3af490a9
--- /dev/null
+++ b/lib/migrations/20160515114000-user-add-tokens.js
@@ -0,0 +1,15 @@
+"use strict";
+
+module.exports = {
+ up: function (queryInterface, Sequelize) {
+ queryInterface.addColumn('Users', 'accessToken', Sequelize.STRING);
+ queryInterface.addColumn('Users', 'refreshToken', Sequelize.STRING);
+ return;
+ },
+
+ down: function (queryInterface, Sequelize) {
+ queryInterface.removeColumn('Users', 'accessToken');
+ queryInterface.removeColumn('Users', 'refreshToken');
+ return;
+ }
+}; \ No newline at end of file
diff --git a/lib/models/user.js b/lib/models/user.js
index 2323dc92..64173cbd 100644
--- a/lib/models/user.js
+++ b/lib/models/user.js
@@ -26,6 +26,9 @@ module.exports = function (sequelize, DataTypes) {
},
accessToken: {
type: DataTypes.STRING
+ },
+ refreshToken: {
+ type: DataTypes.STRING
}
}, {
classMethods: {