-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: helm release 12.1 for default settlement functionality (#853)
* added new foreign key into settlementWindowContent table on settlementModelId * updated dependencies * updated version * fixed dropped foreign key and updated minor version instead of patch * fixed migrate:rollback * fixed down script on swc foreign key
- Loading branch information
Showing
3 changed files
with
522 additions
and
430 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
migrations/950107_settlementWindowContent_foreign_settlementModel.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/***** | ||
License | ||
-------------- | ||
Copyright © 2017 Bill & Melinda Gates Foundation | ||
The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. | ||
Contributors | ||
-------------- | ||
This is the official list of the Mojaloop project contributors for this file. | ||
Names of the original copyright holders (individuals or organizations) | ||
should be listed with a '*' in the first column. People who have | ||
contributed from an organization can be listed under the organization | ||
that actually holds the copyright for their contributions (see the | ||
Gates Foundation organization for an example). Those individuals should have | ||
their names indented and be marked with a '-'. Email address can be added | ||
optionally within square brackets <email>. | ||
* Gates Foundation | ||
- Name Surname <[email protected]> | ||
* ModusBox | ||
- Valentin Genev <[email protected]> | ||
-------------- | ||
******/ | ||
|
||
'use strict' | ||
|
||
exports.up = async (knex) => { | ||
return await knex.schema.hasTable('settlementWindowContent').then(async function (exists) { | ||
if (exists) { | ||
await knex.schema.hasColumn('settlementWindowContent', 'settlementModelId') | ||
.then(async (columnExists) => { | ||
if (!columnExists) { | ||
return knex.schema.alterTable('settlementWindowContent', (t) => { | ||
t.integer('SettlementModelId').unsigned().defaultTo(null) | ||
t.foreign('SettlementModelId').references('SettlementModelId').inTable('settlementModel') | ||
}) | ||
} | ||
}) | ||
} | ||
}) | ||
} | ||
|
||
exports.down = async function (knex) { | ||
return await knex.schema.hasTable('settlementWindowContent').then(async function (exists) { | ||
if (exists) { | ||
await knex.schema.hasColumn('settlementWindowContent', 'settlementModelId') | ||
.then(async (columnExists) => { | ||
if (columnExists) { | ||
return knex.schema | ||
.alterTable('settlementWindowContent', (t) => { | ||
t.dropForeign('SettlementModelId') | ||
t.dropColumn('SettlementModelId') | ||
}) | ||
} | ||
}) | ||
} | ||
}) | ||
} | ||
|
Oops, something went wrong.