obs-ss-plugin-webui/scripts/addGroupNameToTeams.ts
Decobus 5789986bb6
Some checks failed
Lint and Build / build (22) (pull_request) Failing after 32s
Lint and Build / build (20) (pull_request) Failing after 34s
Add OBS group management feature and documentation
- Add group_name column to teams table for mapping teams to OBS groups
- Create API endpoints for group creation (/api/createGroup) and bulk sync (/api/syncGroups)
- Update teams UI with group status display and creation buttons
- Implement automatic group assignment when adding streams
- Add comprehensive OBS setup documentation (docs/OBS_SETUP.md)
- Fix team list spacing issue with explicit margins
- Update OBS client with group management functions
- Add database migration script for existing deployments

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-20 00:28:16 -04:00

57 lines
No EOL
1.6 KiB
TypeScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import sqlite3 from 'sqlite3';
import { open } from 'sqlite';
import path from 'path';
import { getTableName, BASE_TABLE_NAMES } from '../lib/constants';
const FILE_DIRECTORY = path.resolve(process.env.FILE_DIRECTORY || './files');
const addGroupNameToTeams = async () => {
try {
const dbPath = path.join(FILE_DIRECTORY, 'sources.db');
// Open database connection
const db = await open({
filename: dbPath,
driver: sqlite3.Database,
});
console.log('Database connection established.');
// Generate table name for teams
const teamsTableName = getTableName(BASE_TABLE_NAMES.TEAMS, {
year: 2025,
season: 'summer',
suffix: 'sat'
});
console.log(`Adding group_name column to ${teamsTableName}`);
// Check if column already exists
const tableInfo = await db.all(`PRAGMA table_info(${teamsTableName})`);
const hasGroupName = tableInfo.some(col => col.name === 'group_name');
if (!hasGroupName) {
// Add group_name column
await db.exec(`
ALTER TABLE ${teamsTableName}
ADD COLUMN group_name TEXT
`);
console.log(`✅ Added group_name column to ${teamsTableName}`);
} else {
console.log(` group_name column already exists in ${teamsTableName}`);
}
// Close database connection
await db.close();
console.log('Database connection closed.');
console.log('✅ Successfully updated teams table schema!');
} catch (error) {
console.error('Error updating table:', error);
process.exit(1);
}
};
// Run the script
addGroupNameToTeams();