From a0ff02282eb6a5aabdb2b584f22b2396bc46f5de Mon Sep 17 00:00:00 2001 From: Moe Date: Wed, 16 Feb 2022 22:04:44 -0800 Subject: [PATCH] update old sub account rows to use new column on start --- libs/sql.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/libs/sql.js b/libs/sql.js index a2a9ec31..a2af51b1 100644 --- a/libs/sql.js +++ b/libs/sql.js @@ -200,9 +200,17 @@ module.exports = function(s,config){ table.tinyint('subAccount',1).defaultTo(0) }).then(() => { s.systemLog('Created new columns in Users table : subAccount'); - s.databaseEngine('Users') - .update({'subAccount': '1'}) - .where('details', 'like', '%"sub":"1"%'); + s.systemLog('Updating Sub-Acccounts to use new column'); + s.knexQuery({ + action: "update", + table: "Users", + update: { + subAccount: 1 + }, + where: [ + ['details', 'LIKE', '%"sub"%'], + ] + }); }).catch((err) => { if(err && err.code !== 'ER_DUP_FIELDNAME'){ console.log('Error creating new columns in Users table : subAccount')