Migrationen 003–009, Kundaufträge mit Lieferschein, Abräumen mit Urteil, ntfy/Backup/Zeitfenster, Live-Stream und Mobile-Mehr-Menü.
26 lines
970 B
SQL
26 lines
970 B
SQL
CREATE TABLE IF NOT EXISTS maintenance_parts (
|
|
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
|
printer_host text NOT NULL,
|
|
part_key text NOT NULL,
|
|
label text NOT NULL DEFAULT '',
|
|
installed_at timestamptz NOT NULL DEFAULT now(),
|
|
life_hours double precision NOT NULL DEFAULT 0,
|
|
life_meters double precision NOT NULL DEFAULT 0,
|
|
note text NOT NULL DEFAULT ''
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS maintenance_parts_host ON maintenance_parts (printer_host);
|
|
|
|
CREATE TABLE IF NOT EXISTS maintenance_log (
|
|
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
|
printer_host text NOT NULL,
|
|
part_key text NOT NULL,
|
|
event text NOT NULL DEFAULT '',
|
|
hours_at double precision NOT NULL DEFAULT 0,
|
|
meters_at double precision NOT NULL DEFAULT 0,
|
|
created_at timestamptz NOT NULL DEFAULT now(),
|
|
note text NOT NULL DEFAULT ''
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS maintenance_log_host ON maintenance_log (printer_host, created_at DESC);
|