CREATE TABLE HealthCheckConfig(
  ID INTEGER PRIMARY KEY AUTOINCREMENT,
  ServerID INTEGER NOT NULL,
  Type TEXT NOT NULL,
  Title TEXT NOT NULL,
  FOREIGN KEY(ServerID) REFERENCES Server(ID),
  UNIQUE(ServerID, Type, Title)
);

CREATE TABLE HealthCheckParams(
  ID INTEGER PRIMARY KEY AUTOINCREMENT,
  ConfigID INTEGER NOT NULL,
  Type TEXT NOT NULL,
  Key TEXT NOT NULL,
  Value TEXT NOT NULL,
  FOREIGN KEY(ConfigID) REFERENCES HealthCheckConfig(ID),
  UNIQUE(ConfigID, Type, Key)
);

CREATE TABLE HealthCheckDataEntry(
  ID INTEGER PRIMARY KEY AUTOINCREMENT,
  ConfigID INTEGER NOT NULL,
  Timestamp INTEGER NOT NULL,
  Status INTEGER NOT NULL,
  Message TEXT,
  FOREIGN KEY(ConfigID) REFERENCES HealthCheckConfig(ID),
  UNIQUE(ConfigID, Timestamp)
);