Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add defaults to unused column crm.document_header #1006

Merged
merged 2 commits into from Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
45 changes: 45 additions & 0 deletions migrations/20240107235932-alter-crm-document-header.js
@@ -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', '20240107235932-alter-crm-document-header-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', '20240107235932-alter-crm-document-header-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,0 +1,3 @@
/* Replace with your SQL commands *//* See https://eaflood.atlassian.net/browse/WATER-4292 */

ALTER TABLE crm.document_header ALTER COLUMN system_id DROP DEFAULT;
@@ -0,0 +1,3 @@
/* See https://eaflood.atlassian.net/browse/WATER-4292 */

ALTER TABLE crm.document_header ALTER COLUMN system_id SET DEFAULT 'permit-repo';