-
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.
- Loading branch information
Showing
6 changed files
with
76 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
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,43 @@ | ||
'use strict'; | ||
|
||
let dbm; | ||
let type; | ||
let seed; | ||
|
||
/** | ||
* 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) { | ||
console.log('**** Adding feature flag ****'); | ||
const mClient = await db.connection.connect(db.connectionString, { native_parser: true }); | ||
|
||
try { | ||
const nrpti = await mClient.collection('nrpti'); | ||
await nrpti.insertOne({ | ||
_schemaName: 'FeatureFlag', | ||
data: { | ||
"nris-emli-importer": "true" | ||
} | ||
}); | ||
console.log('**** Finished adding flag ****'); | ||
} catch (error) { | ||
console.error(`Migration did not complete. Error processing records: ${error.message}`); | ||
} | ||
|
||
mClient.close(); | ||
} | ||
|
||
exports.down = function(db) { | ||
return null; | ||
} | ||
|
||
exports._meta = { | ||
"version": 1 | ||
} |
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,20 @@ | ||
const mongoose = require('mongoose'); | ||
|
||
module.exports = require('../utils/model-schema-generator')( | ||
'FeatureFlag', | ||
{ | ||
_schemaName: { type: String, default: 'FeatureFlag', index: true }, | ||
data: { type: mongoose.SchemaTypes.Mixed, default: '{}' }, | ||
|
||
addedBy: { type: String, default: null }, | ||
dateAdded: { type: Date, default: Date.now() }, | ||
|
||
updatedBy: { type: String, default: null }, | ||
dateUpdated: { type: Date, default: null }, | ||
|
||
// Permissions | ||
write: [{ type: String, trim: true, default: 'sysadmin' }], | ||
read: [{ type: String, trim: true, default: 'public' }] | ||
}, | ||
'nrpti' | ||
); |
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