add Failed column to Messages table

This commit is contained in:
Connor Olding 2020-08-30 02:30:52 +02:00
parent de0d8f73f0
commit ca136b65a3
4 changed files with 7 additions and 4 deletions

View File

@ -1,11 +1,9 @@
#!/usr/bin/env python3
if __name__ == "__main__":
from sys import argv, stderr
from .ui import ui
if len(argv) == 0:
print("You've met with a terrible fate.", file=stderr)
print("malformed arguments", file=stderr)
ret = 2
else:
ret = ui(argv[0], argv[1:])

View File

@ -252,8 +252,11 @@ class RespoDB:
else:
exception = None
failed = not entry.success
message = self.new_message(
execution=entry.execution,
server=server, domain=domain,
record_id=record_id, exception=exception)
record_id=record_id, exception=exception,
failed=failed)
self.flush()

View File

@ -67,6 +67,7 @@ CREATE TABLE IF NOT EXISTS Messages (
DomainId INTEGER NOT NULL,
RecordId INTEGER,
ExceptionId INTEGER,
Failed BOOLEAN DEFAULT 0 NOT NULL,
FOREIGN KEY(ServerId) REFERENCES Ips(IpId),
FOREIGN KEY(ExecutionId) REFERENCES Executions(ExecutionId),
FOREIGN KEY(DomainId) REFERENCES Domains(DomainId),

View File

@ -61,6 +61,7 @@ class TMessage(rain.Storm, AttrCheck):
domain_id = rain.Int("DomainId")
record_id = rain.Int("RecordId")
exception_id = rain.Int("ExceptionId")
failed = rain.Bool("Failed")
execution = rain.Reference(execution_id, "TExecution.execution_id")
server = rain.Reference(server_id, "TAddress.address_id")
domain = rain.Reference(domain_id, "TDomain.domain_id")