update old sub account rows to use new column on start
parent
e853b5da1b
commit
a0ff02282e
14
libs/sql.js
14
libs/sql.js
|
@ -200,9 +200,17 @@ module.exports = function(s,config){
|
||||||
table.tinyint('subAccount',1).defaultTo(0)
|
table.tinyint('subAccount',1).defaultTo(0)
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
s.systemLog('Created new columns in Users table : subAccount');
|
s.systemLog('Created new columns in Users table : subAccount');
|
||||||
s.databaseEngine('Users')
|
s.systemLog('Updating Sub-Acccounts to use new column');
|
||||||
.update({'subAccount': '1'})
|
s.knexQuery({
|
||||||
.where('details', 'like', '%"sub":"1"%');
|
action: "update",
|
||||||
|
table: "Users",
|
||||||
|
update: {
|
||||||
|
subAccount: 1
|
||||||
|
},
|
||||||
|
where: [
|
||||||
|
['details', 'LIKE', '%"sub"%'],
|
||||||
|
]
|
||||||
|
});
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
if(err && err.code !== 'ER_DUP_FIELDNAME'){
|
if(err && err.code !== 'ER_DUP_FIELDNAME'){
|
||||||
console.log('Error creating new columns in Users table : subAccount')
|
console.log('Error creating new columns in Users table : subAccount')
|
||||||
|
|
Loading…
Reference in New Issue