KEA Setup
All checks were successful
Deploy / deploy-staging (push) Successful in 6s
Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-04-13 02:13:43 +02:00
parent 4d73eec687
commit 677f9314f5
8 changed files with 285 additions and 73 deletions

View File

@@ -98,10 +98,6 @@ final class Database
}
}
// After init, ensure our metadata table exists (non-invasive)
if (self::tableExists($pdo, 'hosts')) {
self::ensureNexusTables($pdo);
}
}
private static function tableExists(\PDO $pdo, string $table): bool
@@ -179,37 +175,6 @@ final class Database
$pdo->exec($sql);
}
private static function ensureNexusTables(\PDO $pdo): void
{
$pdo->exec(
"CREATE TABLE IF NOT EXISTS nexus_host_meta (
host_id BIGINT PRIMARY KEY,
location TEXT,
device_type TEXT,
owner TEXT,
tags JSONB,
notes TEXT,
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
)"
);
$pdo->exec(
"DO $$
BEGIN
IF NOT EXISTS (
SELECT 1 FROM information_schema.table_constraints
WHERE constraint_name = 'fk_nexus_host_meta_host'
) THEN
ALTER TABLE nexus_host_meta
ADD CONSTRAINT fk_nexus_host_meta_host
FOREIGN KEY (host_id)
REFERENCES hosts(host_id)
ON DELETE CASCADE;
END IF;
END $$;"
);
}
private static function buildMysqlDsn(array $db): string
{
if (empty($db['dbname'])) {