This commit is contained in:
+15
@@ -99,5 +99,20 @@ def migrate():
|
||||
'"erstellt_am" bigint, '
|
||||
'"zuletzt_gesehen" bigint)'
|
||||
)
|
||||
# Änderungsverlauf der Tablet-Zuordnungen (wer/was/wann)
|
||||
cur.execute(
|
||||
'CREATE TABLE IF NOT EXISTS "Tablet_Verlauf" ('
|
||||
'"id" serial PRIMARY KEY, "zeitpunkt" bigint NOT NULL, "tablet_id" integer, "kennung" text, '
|
||||
'"tablet_name" text, "aktion" text NOT NULL, "details" text, "von_ip" text)'
|
||||
)
|
||||
# Ziel "Maschinen-Auswahl" wurde entfernt: betroffene Tablets sind wieder unzugeordnet.
|
||||
cur.execute(
|
||||
'INSERT INTO "Tablet_Verlauf" (zeitpunkt, tablet_id, kennung, tablet_name, aktion, details) '
|
||||
"SELECT %s, id, kennung, name, 'Zuordnung entfernt', "
|
||||
"'Ziel \"Maschinen-Auswahl\" gibt es nicht mehr: Tablet ist wieder nicht zugeordnet' "
|
||||
'FROM "Tablets" WHERE ziel_typ = \'auswahl\'',
|
||||
(int(time.time()),),
|
||||
)
|
||||
cur.execute('UPDATE "Tablets" SET ziel_typ = NULL, maschine_id = NULL WHERE ziel_typ = \'auswahl\'')
|
||||
cur.execute('CREATE TABLE IF NOT EXISTS "Einstellungen" ("schluessel" text PRIMARY KEY, "wert" text)')
|
||||
log.info("Schema-Migration geprüft/angewendet.")
|
||||
|
||||
Reference in New Issue
Block a user