feat: add company sidebar filters, internal phone, mail icon fix, and update script

This commit is contained in:
2026-05-26 09:08:34 +07:00
parent 7e11d42bbb
commit fc4a283c0a
10 changed files with 250 additions and 27 deletions
+9
View File
@@ -78,11 +78,20 @@ async function initializeTables() {
email TEXT,
building TEXT,
floor TEXT,
internal_phone TEXT,
FOREIGN KEY (department_id) REFERENCES departments(id) ON DELETE SET NULL,
FOREIGN KEY (company_id) REFERENCES companies(id) ON DELETE SET NULL
)
`);
// Dynamic schema migration: add internal_phone column if it does not exist
const columns = await all('PRAGMA table_info(employees)');
const hasInternalPhone = columns.some((col) => col.name === 'internal_phone');
if (!hasInternalPhone) {
console.log('Migrating database: adding internal_phone column to employees table...');
await run('ALTER TABLE employees ADD COLUMN internal_phone TEXT');
}
// Seed data if database is fresh
const deptCount = await get('SELECT COUNT(*) as count FROM departments');
if (deptCount.count === 0) {