Skip to content

Commit

Permalink
Record table: added info column (#68)
Browse files Browse the repository at this point in the history
Co-authored-by: Stefano Ricci <[email protected]>
  • Loading branch information
SteRiccio and SteRiccio authored Nov 30, 2023
1 parent e4922f7 commit 5d470db
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
'use strict'

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
}

exports.up = function (db) {
var filePath = path.join(__dirname, 'sqls', '20231123083354-alter-table-record-add-column-info-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', '20231123083354-alter-table-record-add-column-info-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,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* Replace with your SQL commands */
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE record
ADD COLUMN info jsonb NOT NULL DEFAULT '{}'::jsonb;

0 comments on commit 5d470db

Please sign in to comment.