brainz-social-old/migrations/20231002234759-oauthCode.js

43 lines
1,016 B
JavaScript
Raw Normal View History

2023-10-02 19:38:21 -05:00
"use strict";
const async = require("async");
let dbm;
let type;
let seed;
/**
* We receive the dbmigrate dependency from dbmigrate initially.
* This enables us to not have to rely on NODE_PATH.
*/
exports.setup = function(options, seedLink) {
dbm = options.dbmigrate;
type = dbm.dataType;
seed = seedLink;
};
exports.up = function(db, callback) {
async.series([
db.createTable.bind(db, "oauth_code", {
id: {type: "int", primaryKey: true, autoIncrements: true},
code: {type: "string", unique: true},
application_id: "int",
scopes: "string",
user_id: "int",
created_at: "int"
}),
db.addIndex.bind(db, "oauth_code", "oauth_code_index", ["code"])
], callback);
};
exports.down = function(db, callback) {
async.series([
db.removeIndex.bind(db, "oauth_code", "oauth_code_index"),
db.dropTable.bind(db, "oauth_code")
], callback);
};
exports._meta = {
2023-10-06 22:05:11 -05:00
version: 1
2023-10-02 19:38:21 -05:00
};