Implemented system to track member qualifications from training reports
This commit is contained in:
45
api/migrations/20260330120000-qualification-sync.js
Normal file
45
api/migrations/20260330120000-qualification-sync.js
Normal file
@@ -0,0 +1,45 @@
|
||||
'use strict';
|
||||
|
||||
var dbm;
|
||||
var type;
|
||||
var seed;
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var Promise;
|
||||
|
||||
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', '20260330120000-qualification-sync-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);
|
||||
resolve(data);
|
||||
});
|
||||
}).then(function(data) {
|
||||
return db.runSql(data);
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function(db) {
|
||||
var filePath = path.join(__dirname, 'sqls', '20260330120000-qualification-sync-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);
|
||||
resolve(data);
|
||||
});
|
||||
}).then(function(data) {
|
||||
return db.runSql(data);
|
||||
});
|
||||
};
|
||||
|
||||
exports._meta = {
|
||||
version: 1,
|
||||
};
|
||||
Reference in New Issue
Block a user