"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 = { version: 1, };