-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.js
More file actions
31 lines (29 loc) · 795 Bytes
/
install.js
File metadata and controls
31 lines (29 loc) · 795 Bytes
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
module.exports = {
updates() {
return [{
version: '2.0.1',
update(we, done) {
we.log.info('Start project update v2.0.1');
const sql = `ALTER TABLE \`users\` ADD COLUMN \`blocked\` TINYINT(1) NULL DEFAULT 0`;
we.db.defaultConnection
.query(sql)
.then( ()=> {
we.log.info('Done project update v2.0.1');
done();
return null;
})
.catch( (err)=> {
if (err.name == 'SequelizeDatabaseError') {
if (err.message == `Duplicate column name 'blocked'`) {
// fields already exists, nothing to do:
done();
return null;
}
}
done(err); // unknow error
return null;
});
}
}];
}
};