Skip to content

Commit

Permalink
fix update script
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianVennen committed Mar 15, 2021
1 parent 0c8863c commit e9aa9ca
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion update/0.1.1.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ async function update() {
console.log('Starting update to v0.1.1');

console.log('Updating tables...');
await database.query('ALTER TABLE `channels` ADD COLUMN IF NOT EXISTS `guildid` VARCHAR(20)');
try {
await database.query('ALTER TABLE `channels` ADD COLUMN `guildid` VARCHAR(20)');
}
catch (e) {
if (e.code === 'ER_DUP_FIELDNAME')
console.log('Channels table already up to date');
else
throw e;
}
console.log('Done!')
console.log('Updating entries...')
const channelIDs = await database.queryAll('SELECT id FROM channels WHERE guildid IS null');
Expand Down

0 comments on commit e9aa9ca

Please sign in to comment.