This commit is contained in:
+15
@@ -114,5 +114,20 @@ def migrate():
|
||||
(int(time.time()),),
|
||||
)
|
||||
cur.execute('UPDATE "Tablets" SET ziel_typ = NULL, maschine_id = NULL WHERE ziel_typ = \'auswahl\'')
|
||||
cur.execute('ALTER TABLE "Tablet_Verlauf" ADD COLUMN IF NOT EXISTS "benutzer" text')
|
||||
# Benutzer mit Rechten (Passwörter nur als Hash)
|
||||
cur.execute(
|
||||
'CREATE TABLE IF NOT EXISTS "Benutzer" ('
|
||||
'"id" serial PRIMARY KEY, "benutzername" text NOT NULL, "anzeigename" text, "passwort_hash" text NOT NULL, '
|
||||
'"admin" boolean NOT NULL DEFAULT false, '
|
||||
'"recht_auftraege" boolean NOT NULL DEFAULT false, "recht_korrektur" boolean NOT NULL DEFAULT false, '
|
||||
'"recht_geraete" boolean NOT NULL DEFAULT false, "recht_maschinen" boolean NOT NULL DEFAULT false, '
|
||||
'"aktiv" boolean NOT NULL DEFAULT true, "erstellt_am" bigint, "letzter_login" bigint)'
|
||||
)
|
||||
cur.execute('CREATE UNIQUE INDEX IF NOT EXISTS "benutzer_name_lc" ON "Benutzer" (lower("benutzername"))')
|
||||
cur.execute(
|
||||
'CREATE TABLE IF NOT EXISTS "Benutzer_Verlauf" ('
|
||||
'"id" serial PRIMARY KEY, "zeitpunkt" bigint NOT NULL, "akteur" text, "aktion" text NOT NULL, "details" text)'
|
||||
)
|
||||
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