Projektsuche Implementiert mit anbindung an INFRA
This commit is contained in:
25
database.js
25
database.js
@@ -336,6 +336,31 @@ function initDatabase() {
|
||||
}
|
||||
});
|
||||
|
||||
// MSSQL-Konfigurations-Tabelle für externe Projekt-/Kunden-Datenbank
|
||||
db.run(`CREATE TABLE IF NOT EXISTS mssql_config (
|
||||
id INTEGER PRIMARY KEY DEFAULT 1,
|
||||
server TEXT,
|
||||
database TEXT,
|
||||
username TEXT,
|
||||
password TEXT,
|
||||
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
CHECK (id = 1)
|
||||
)`, (err) => {
|
||||
if (err && !err.message.includes('duplicate column')) {
|
||||
console.warn('Warnung beim Erstellen der mssql_config Tabelle:', err.message);
|
||||
}
|
||||
});
|
||||
|
||||
// Standard-Eintrag für mssql_config erstellen falls nicht vorhanden
|
||||
db.run(
|
||||
`INSERT OR IGNORE INTO mssql_config (id, server, database, username, password) VALUES (1, '', '', '', '')`,
|
||||
(err) => {
|
||||
if (err && !err.message.includes('UNIQUE constraint')) {
|
||||
console.warn('Warnung beim Erstellen des Standard-Eintrags für mssql_config:', err.message);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Migration: Bestehende Rollen zu JSON-Arrays konvertieren
|
||||
// Prüfe ob Rollen noch als einfache Strings gespeichert sind (nicht als JSON-Array)
|
||||
db.all('SELECT id, role FROM users', (err, users) => {
|
||||
|
||||
Reference in New Issue
Block a user