Skip to content

Commit

Permalink
Implement fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Cruikshanks committed Oct 3, 2024
1 parent a862dd8 commit 2ab3570
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions migrations/20241003162404-fix-multiple-current-licence-holders.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
'use strict'

const fs = require('fs')
const path = require('path')
let 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) {
Promise = options.Promise
}

exports.up = function (db) {
const filePath = path.join(__dirname, 'sqls', '20241003162404-fix-multiple-current-licence-holders-up.sql')
return new Promise(function (resolve, reject) {
fs.readFile(filePath, { encoding: 'utf-8' }, function (err, data) {
if (err) return reject(err)

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

exports.down = function (db) {
const filePath = path.join(__dirname, 'sqls', '20241003162404-fix-multiple-current-licence-holders-down.sql')
return new Promise(function (resolve, reject) {
fs.readFile(filePath, { encoding: 'utf-8' }, function (err, data) {
if (err) return reject(err)

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

exports._meta = {
version: 1
}

0 comments on commit 2ab3570

Please sign in to comment.