Skip to content

Commit

Permalink
fix: down jwt registry migration
Browse files Browse the repository at this point in the history
  • Loading branch information
clostao committed Nov 25, 2024
1 parent 2732cbb commit 27d4cf5
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 43 deletions.
88 changes: 46 additions & 42 deletions backend/migrations/20241125160059-jwt-token-registry.js
Original file line number Diff line number Diff line change
@@ -1,53 +1,57 @@
'use strict';
'use strict'

var dbm;
var type;
var seed;
var fs = require('fs');
var path = require('path');
var Promise;
var dbm
var type
var seed
var fs = require('fs')
var path = require('path')
var Promise

/**
* 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;
Promise = options.Promise;
};
* 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
Promise = options.Promise
}

exports.up = function(db) {
var filePath = path.join(__dirname, 'sqls', '20241125160059-jwt-token-registry-up.sql');
return new Promise( function( resolve, reject ) {
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
if (err) return reject(err);
console.log('received data: ' + data);
exports.up = function (db) {
var filePath = path.join(
__dirname,
'sqls',
'20241125160059-jwt-token-registry-up.sql',
)
return new Promise(function (resolve, reject) {
fs.readFile(filePath, { encoding: 'utf-8' }, function (err, data) {
if (err) return reject(err)

resolve(data);
});
resolve(data)
})
}).then(function (data) {
return db.runSql(data)
})
.then(function(data) {
return db.runSql(data);
});
};
}

exports.down = function(db) {
var filePath = path.join(__dirname, 'sqls', '20241125160059-jwt-token-registry-down.sql');
return new Promise( function( resolve, reject ) {
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
if (err) return reject(err);
console.log('received data: ' + data);
exports.down = function (db) {
var filePath = path.join(
__dirname,
'sqls',
'20241125160059-jwt-token-registry-down.sql',
)
return new Promise(function (resolve, reject) {
fs.readFile(filePath, { encoding: 'utf-8' }, function (err, data) {
if (err) return reject(err)

resolve(data);
});
resolve(data)
})
}).then(function (data) {
return db.runSql(data)
})
.then(function(data) {
return db.runSql(data);
});
};
}

exports._meta = {
"version": 1
};
version: 1,
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/* Replace with your SQL commands */
DROP TABLE IF EXISTS jwt_token_registry;

0 comments on commit 27d4cf5

Please sign in to comment.