-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy path20190916105700-addProjectPhase.js
56 lines (50 loc) · 1.13 KB
/
20190916105700-addProjectPhase.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
'use strict';
var dbm;
var type;
var 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;
};
let item = {
"type" : "projectPhase",
"_schemaName" : "List",
"name" : "Other"
};
exports.up = function(db) {
let mClient;
return db.connection.connect(db.connectionString, { native_parser: true })
.then((mClientInst) => {
// mClientInst is an instance of MongoClient
mClient = mClientInst;
var p = mClient.collection('epic');
p.insertOne(item)
.then(function (arr) {
for(let item of arr.ops) {
p.update(
{
_id: item._id
},
{
$set: { read: ['public', 'staff', 'sysadmin'], write: ['staff', 'sysadmin'] }
});
}
mClient.close();
});
})
.catch((e) => {
console.log("e:", e);
mClient.close()
});
};
exports.down = function(db) {
return null;
};
exports._meta = {
"version": 1
};