Add db migrations for PR #121
This commit is contained in:
parent
93c6205aa6
commit
baa946968d
5 changed files with 31 additions and 0 deletions
8
.sequelizerc
Normal file
8
.sequelizerc
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
var path = require('path');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
'config': path.resolve('config.json'),
|
||||||
|
'migrations-path': path.resolve('lib', 'migrations'),
|
||||||
|
'models-path': path.resolve('lib', 'models'),
|
||||||
|
'url': 'change this'
|
||||||
|
}
|
|
@ -125,6 +125,10 @@ Third-party integration api key settings
|
||||||
| imgur | `config.json` | for image upload |
|
| imgur | `config.json` | for image upload |
|
||||||
| google drive, dropbox | `public/js/common.js` | for export and import |
|
| google drive, dropbox | `public/js/common.js` | for export and import |
|
||||||
|
|
||||||
|
DB migration
|
||||||
|
---
|
||||||
|
Modify the file named `.sequelizerc`, change the value of the variable `url` with your db connection string.
|
||||||
|
And run `node_modules/.bin/sequelize db:migrate`, that's it!
|
||||||
|
|
||||||
Operational Transformation
|
Operational Transformation
|
||||||
---
|
---
|
||||||
|
|
15
lib/migrations/20160515114000-user-add-tokens.js
Normal file
15
lib/migrations/20160515114000-user-add-tokens.js
Normal file
|
@ -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;
|
||||||
|
}
|
||||||
|
};
|
|
@ -26,6 +26,9 @@ module.exports = function (sequelize, DataTypes) {
|
||||||
},
|
},
|
||||||
accessToken: {
|
accessToken: {
|
||||||
type: DataTypes.STRING
|
type: DataTypes.STRING
|
||||||
|
},
|
||||||
|
refreshToken: {
|
||||||
|
type: DataTypes.STRING
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
classMethods: {
|
classMethods: {
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
"request": "^2.72.0",
|
"request": "^2.72.0",
|
||||||
"reveal.js": "3.2.0",
|
"reveal.js": "3.2.0",
|
||||||
"sequelize": "^3.21.0",
|
"sequelize": "^3.21.0",
|
||||||
|
"sequelize-cli": "^2.4.0",
|
||||||
"shortid": "2.2.6",
|
"shortid": "2.2.6",
|
||||||
"socket.io": "1.4.5",
|
"socket.io": "1.4.5",
|
||||||
"sqlite3": "^3.1.3",
|
"sqlite3": "^3.1.3",
|
||||||
|
|
Loading…
Reference in a new issue