Skip to content

Commit

Permalink
Merge pull request #222 from aternosorg/deleteData
Browse files Browse the repository at this point in the history
fix update script
  • Loading branch information
KurtThiemann authored Mar 15, 2021
2 parents a9e79e9 + fbf0e96 commit 3bc2b8d
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 3bc2b8d

Please sign in to comment.