feat: initialize Discord clone application with core backend services and Electron frontend.

This commit is contained in:
Bryan1029384756
2026-02-09 23:54:49 -06:00
parent e64cf20116
commit 516cfdbbd8
26 changed files with 622 additions and 161 deletions

View File

@@ -0,0 +1,32 @@
const path = require('path');
require('dotenv').config({ path: path.join(__dirname, '../.env') });
const db = require('../db');
async function migrate() {
try {
console.log('Running DM migration...');
// 1. Update the check constraint to allow 'dm' type
await db.query("ALTER TABLE channels DROP CONSTRAINT IF EXISTS channels_type_check");
await db.query("ALTER TABLE channels ADD CONSTRAINT channels_type_check CHECK (type IN ('text', 'voice', 'dm'))");
console.log(' Updated channels type constraint to allow dm.');
// 2. Create dm_participants table
await db.query(`
CREATE TABLE IF NOT EXISTS dm_participants (
channel_id UUID REFERENCES channels(id) ON DELETE CASCADE,
user_id UUID REFERENCES users(id) ON DELETE CASCADE,
PRIMARY KEY (channel_id, user_id)
)
`);
console.log(' Created dm_participants table.');
console.log('DM migration complete.');
process.exit(0);
} catch (err) {
console.error('DM migration failed:', err);
process.exit(1);
}
}
migrate();