feat: add company sidebar filters, internal phone, mail icon fix, and update script
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user