-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NRPT-129: Fix offense string and fix database. (#396)
- Loading branch information
Showing
2 changed files
with
39 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
'use strict' | ||
|
||
var dbm | ||
var type | ||
var seed | ||
|
||
const badString = "Penalty for failure to compluy with the Act or associated regulations" | ||
const goodString = "Penalty for failure to comply with the Act or associated regulations" | ||
|
||
/** | ||
* 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 | ||
}; | ||
|
||
exports.up = async function(db) { | ||
const mClient = await db.connection.connect(db.connectionString, { native_parser: true }) | ||
try { | ||
const nrptiCollection = await mClient.collection('nrpti') | ||
await nrptiCollection.updateMany({offence: badString}, { $set: { offence: goodString } }) | ||
mClient.close() | ||
} catch (e) { | ||
console.log('Error', e) | ||
mClient.close() | ||
} | ||
} | ||
|
||
exports.down = function(db) { | ||
return null | ||
} | ||
|
||
exports._meta = { | ||
"version": 1 | ||
} |