~jan0sch/smederee

Showing details for patch d517b2f66b2d7e550d9939e71a971a83021ed43c.
2025-04-20 (Sun), 2:38 PM - Jens Grassel - d517b2f66b2d7e550d9939e71a971a83021ed43c

vcs: Add db table to cache health check results in the future.

Summary of changes
1 files added
  • modules/hub/src/main/resources/db/migration/hub/V10__repository_health_tables.sql
diff -rN -u old-smederee/modules/hub/src/main/resources/db/migration/hub/V10__repository_health_tables.sql new-smederee/modules/hub/src/main/resources/db/migration/hub/V10__repository_health_tables.sql
--- old-smederee/modules/hub/src/main/resources/db/migration/hub/V10__repository_health_tables.sql	1970-01-01 00:00:00.000000000 +0000
+++ new-smederee/modules/hub/src/main/resources/db/migration/hub/V10__repository_health_tables.sql	2025-06-20 20:48:29.987034500 +0000
@@ -0,0 +1,23 @@
+CREATE TABLE hub.repository_health
+(
+  repository BIGINT NOT NULL,
+  command    TEXT,
+  exit_code  INTEGER,
+  stderr     TEXT,
+  stdout     TEXT,
+  created_at TIMESTAMP WITH TIME ZONE NOT NULL,
+  CONSTRAINT repo_health_pk     PRIMARY KEY (repository),
+  CONSTRAINT repo_health_fk_rid FOREIGN KEY (repository)
+    REFERENCES hub.repositories (id) ON UPDATE CASCADE ON DELETE CASCADE
+)
+WITH (
+  OIDS=FALSE
+);
+
+COMMENT ON TABLE hub.repository_health IS 'This table stores the results of the last check run for the health of a repository.';
+COMMENT ON COLUMN hub.repository_health.repository IS 'The internal database ID of a repository.';
+COMMENT ON COLUMN hub.repository_health.command IS 'The command that was run on the repository.';
+COMMENT ON COLUMN hub.repository_health.exit_code IS 'The exit code of the command, usually 0 implies no errors.';
+COMMENT ON COLUMN hub.repository_health.stderr IS 'Saved output of the standard error channel of the command.';
+COMMENT ON COLUMN hub.repository_health.stdout IS 'Saved output of the standard output channel of the command.';
+COMMENT ON COLUMN hub.repository_health.created_at IS 'The timestamp of when this entry was created which should be the last time the command was run.';