18 lines
557 B
JavaScript
18 lines
557 B
JavaScript
const path = require('path');
|
|
require('dotenv').config({ path: path.join(__dirname, '../.env') });
|
|
const db = require('../db');
|
|
|
|
async function migrate() {
|
|
try {
|
|
console.log('Running migration...');
|
|
await db.query("ALTER TABLE channels ADD COLUMN IF NOT EXISTS type TEXT DEFAULT 'text' CHECK (type IN ('text', 'voice'))");
|
|
console.log('Migration complete: Added type column to channels.');
|
|
process.exit(0);
|
|
} catch (err) {
|
|
console.error('Migration failed:', err);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
migrate();
|