-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(EMS-3722-3723): data migration - eligibility, export contract (#…
…2901) * feat(EMS-3722-3723): data migration - export contract award method * feat(EMS-3722): data migration - eligibility updates * feat(EMS-3722): data migration - eligibility - conditional task list requirements * fix(EMS-3633): data migration - declarations versioning issue * chore(db): update timestamp * fix(EMS-3633): data migration - declarations versioning issue * chore(docs): fix typos * chore(helpers): improve canSubmitApplication logging * chore(migration): simplify promise.all
- Loading branch information
Showing
38 changed files
with
317 additions
and
123 deletions.
There are no files selected for viewing
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
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
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
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
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
66 changes: 66 additions & 0 deletions
66
...gration/version-1-to-version-2/create-tables/create-export-contract-award-method-table.ts
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,66 @@ | ||
import { Connection } from 'mysql2/promise'; | ||
import executeSqlQuery from '../execute-sql-query'; | ||
|
||
/** | ||
* createExportContractAwardMethodTable | ||
* Create new "export contract - award method" database table. | ||
* @param {Connection} connection: SQL database connection | ||
* @returns {Promise<Array<object>>} executeSqlQuery response | ||
*/ | ||
const createExportContractAwardMethodTable = async (connection: Connection) => { | ||
const loggingMessage = 'Creating TABLE - export contract award method'; | ||
|
||
console.info(`✅ ${loggingMessage}`); | ||
|
||
try { | ||
const query = ` | ||
CREATE TABLE ExportContractAwardMethod ( | ||
id varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, | ||
value varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', | ||
PRIMARY KEY (id) | ||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci; | ||
`; | ||
|
||
await executeSqlQuery({ connection, query, loggingMessage }); | ||
|
||
const awardMethodPromises = [ | ||
executeSqlQuery({ | ||
connection, | ||
query: `INSERT INTO ExportContractAwardMethod (id, value) VALUES ('eg9qxlqw4edxa8b5mwbybsrfp', 'Open tender')`, | ||
loggingMessage, | ||
}), | ||
|
||
executeSqlQuery({ | ||
connection, | ||
query: `INSERT INTO ExportContractAwardMethod (id, value) VALUES ('mzwp337piamg1mei7fqh1o73s', 'Negotiated contract')`, | ||
loggingMessage, | ||
}), | ||
|
||
executeSqlQuery({ | ||
connection, | ||
query: `INSERT INTO ExportContractAwardMethod (id, value) VALUES ('qnqrle4xwsj5go8pchj31sat4', 'Direct award')`, | ||
loggingMessage, | ||
}), | ||
|
||
executeSqlQuery({ | ||
connection, | ||
query: `INSERT INTO ExportContractAwardMethod (id, value) VALUES ('qw2hp8khykctdic2z58z70ru8', 'Competitive bidding')`, | ||
loggingMessage, | ||
}), | ||
|
||
executeSqlQuery({ | ||
connection, | ||
query: `INSERT INTO ExportContractAwardMethod (id, value) VALUES ('tn8k8lot1bvirmztmmgq2u8hn', 'Other')`, | ||
loggingMessage, | ||
}), | ||
]; | ||
|
||
return Promise.all(awardMethodPromises); | ||
} catch (err) { | ||
console.error(`🚨 error ${loggingMessage} %O`, err); | ||
|
||
throw new Error(`🚨 error ${loggingMessage} ${err}`); | ||
} | ||
}; | ||
|
||
export default createExportContractAwardMethodTable; |
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
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
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
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
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
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
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
34 changes: 34 additions & 0 deletions
34
src/api/data-migration/version-1-to-version-2/update-applications/add-eligibility-fields.ts
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,34 @@ | ||
import { Connection } from 'mysql2/promise'; | ||
import executeSqlQuery from '../execute-sql-query'; | ||
|
||
/** | ||
* addEligibilityFields | ||
* Add new fields to the eligibility table. | ||
* @param {Connection} connection: SQL database connection | ||
* @returns {Promise<Array<object>>} executeSqlQuery response | ||
*/ | ||
const addEligibilityFields = async (connection: Connection) => { | ||
const promises = await Promise.all([ | ||
executeSqlQuery({ | ||
connection, | ||
query: `ALTER TABLE Eligibility ADD hasEndBuyer tinyint(1) NOT NULL DEFAULT '0'`, | ||
loggingMessage: 'Adding FIELD hasEndBuyer to eligibility table', | ||
}), | ||
|
||
executeSqlQuery({ | ||
connection, | ||
query: `ALTER TABLE Eligibility ADD isMemberOfAGroup tinyint(1) NOT NULL DEFAULT '0'`, | ||
loggingMessage: 'Adding FIELD isMemberOfAGroup to eligibility table', | ||
}), | ||
|
||
executeSqlQuery({ | ||
connection, | ||
query: `ALTER TABLE Eligibility ADD isPartyToConsortium tinyint(1) NOT NULL DEFAULT '0'`, | ||
loggingMessage: 'Adding FIELD isPartyToConsortium to eligibility table', | ||
}), | ||
]); | ||
|
||
return promises; | ||
}; | ||
|
||
export default addEligibilityFields; |
20 changes: 0 additions & 20 deletions
20
...gration/version-1-to-version-2/update-applications/add-eligibility-has-end-buyer-field.ts
This file was deleted.
Oops, something went wrong.
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
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
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
Oops, something went wrong.