software steht so weit.

jetzt build + docker build und testen
This commit is contained in:
br committed 2026-10-02 13:25:34 +02:00
1 parent 42f0c0accb
commit ca6cdcca63
90 files changed
+10298 -480

No files matched your search

+38
View File
@@ -64,6 +64,41 @@ var migrations = []string{
used INTEGER NOT NULL DEFAULT 0
);
CREATE INDEX enrollment_tokens_tenant_id ON enrollment_tokens(tenant_id);`,
// v2: Server-Einstellungen, die auch `sultan token` (eigener Prozess) braucht.
`CREATE TABLE settings (
key TEXT PRIMARY KEY,
value TEXT NOT NULL
);`,
// v3: Wartung pro Knoten (eigene Dimension neben online/offline/drained).
`ALTER TABLE nodes ADD COLUMN maintenance_since DATETIME;
ALTER TABLE nodes ADD COLUMN maintenance_until DATETIME;
ALTER TABLE nodes ADD COLUMN maintenance_reason TEXT NOT NULL DEFAULT '';
ALTER TABLE nodes ADD COLUMN maintenance_public_reason TEXT NOT NULL DEFAULT '';`,
// v4: Leases, Befehlswarteschlange, Features und Zahlungsstatus, Einlösezeitpunkt.
`CREATE TABLE leases (
node_id TEXT PRIMARY KEY REFERENCES nodes(id) ON DELETE CASCADE,
issued_at DATETIME NOT NULL,
renew_after DATETIME NOT NULL,
valid_until DATETIME NOT NULL,
document TEXT NOT NULL
);
CREATE TABLE node_commands (
id INTEGER PRIMARY KEY AUTOINCREMENT,
node_id TEXT NOT NULL REFERENCES nodes(id) ON DELETE CASCADE,
command TEXT NOT NULL,
reason TEXT NOT NULL DEFAULT '',
created_at DATETIME NOT NULL,
sent_at DATETIME
);
CREATE INDEX node_commands_pending ON node_commands(node_id, sent_at);
ALTER TABLE tenants ADD COLUMN features TEXT NOT NULL DEFAULT '[]';
ALTER TABLE tenants ADD COLUMN payment_overdue_since DATETIME;
ALTER TABLE enrollment_tokens ADD COLUMN used_at DATETIME;`,
// v5: versandte Benachrichtigungen (jedes Ereignis genau einmal).
`CREATE TABLE notifications (
key TEXT PRIMARY KEY,
sent_at DATETIME NOT NULL
);`,
}
// Store ist der Zugriff auf die SQLite-Datenbank. Er ist für parallele
@@ -147,6 +182,9 @@ type dbTime struct{ t *time.Time }
func (d dbTime) Scan(src any) error {
switch v := src.(type) {
case nil: // NULL = nicht gesetzt
*d.t = time.Time{}
return nil
case time.Time:
*d.t = normTime(v)
return nil