Fix: Add database migration for new columns
All checks were successful
Auto Build and Push Docker Image / build (push) Successful in 6s
All checks were successful
Auto Build and Push Docker Image / build (push) Successful in 6s
ALTER TABLE guild_settings adds missing columns: - welcome_message, goodbye_message - log_channel, log_events Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -103,6 +103,23 @@ export class DB {
|
||||
)
|
||||
`).run();
|
||||
|
||||
// Migration: Add missing columns to existing guild_settings
|
||||
const columns = db.prepare("PRAGMA table_info(guild_settings)").all() as any[];
|
||||
const columnNames = columns.map((c: any) => c.name);
|
||||
|
||||
if (!columnNames.includes('welcome_message')) {
|
||||
db.prepare('ALTER TABLE guild_settings ADD COLUMN welcome_message TEXT').run();
|
||||
}
|
||||
if (!columnNames.includes('goodbye_message')) {
|
||||
db.prepare('ALTER TABLE guild_settings ADD COLUMN goodbye_message TEXT').run();
|
||||
}
|
||||
if (!columnNames.includes('log_channel')) {
|
||||
db.prepare('ALTER TABLE guild_settings ADD COLUMN log_channel TEXT').run();
|
||||
}
|
||||
if (!columnNames.includes('log_events')) {
|
||||
db.prepare('ALTER TABLE guild_settings ADD COLUMN log_events TEXT DEFAULT \'messages,roles,nicks,channels,warns,mutes,kicks,bans\'').run();
|
||||
}
|
||||
|
||||
console.log('[DATABASE] Initialization complete.');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user