removed users table relicts

This commit is contained in:
2025-10-12 17:27:07 +02:00
parent 90d8ae5140
commit 142bee1cf9
13 changed files with 254 additions and 209 deletions

View File

@@ -3,7 +3,6 @@ import { db } from '../services/databaseService.js';
async function checkTemplates() {
try {
// KORREKTUR: employees statt users verwenden
const templates = await db.all<any>(
`SELECT sp.*, e.name as created_by_name
FROM shift_plans sp

View File

@@ -18,7 +18,7 @@ export async function initializeDatabase(): Promise<void> {
// Check if users table exists and has data
try {
const existingAdmin = await db.get<{ count: number }>(
"SELECT COUNT(*) as count FROM users WHERE role = 'admin'"
"SELECT COUNT(*) as count FROM employees WHERE role = 'admin'"
);
if (existingAdmin && existingAdmin.count > 0) {
@@ -43,12 +43,14 @@ export async function initializeDatabase(): Promise<void> {
// Drop existing tables in reverse order of dependencies if they exist
const tablesToDrop = [
'employee_availabilities',
'assigned_shifts',
'shift_plans',
'template_shifts',
'shift_templates',
'users'
'employees',
'time_slots',
'shifts',
'scheduled_shifts',
'shift_assignments',
'employee_availability',
'applied_migrations',
'shift_plans'
];
for (const table of tablesToDrop) {