mirror of
https://github.com/fosrl/pangolin.git
synced 2026-04-18 15:56:35 +00:00
Many to one on sites and health checks
This commit is contained in:
@@ -471,11 +471,6 @@ export const alertRules = sqliteTable("alertRules", {
|
||||
| "health_check_not_healthy"
|
||||
>()
|
||||
.notNull(),
|
||||
siteId: integer("siteId").references(() => sites.siteId, { onDelete: "cascade" }),
|
||||
healthCheckId: integer("healthCheckId").references(
|
||||
() => targetHealthCheck.targetHealthCheckId,
|
||||
{ onDelete: "cascade" }
|
||||
),
|
||||
enabled: integer("enabled", { mode: "boolean" }).notNull().default(true),
|
||||
cooldownSeconds: integer("cooldownSeconds").notNull().default(300),
|
||||
lastTriggeredAt: integer("lastTriggeredAt"),
|
||||
@@ -483,6 +478,26 @@ export const alertRules = sqliteTable("alertRules", {
|
||||
updatedAt: integer("updatedAt").notNull()
|
||||
});
|
||||
|
||||
export const alertSites = sqliteTable("alertSites", {
|
||||
alertRuleId: integer("alertRuleId")
|
||||
.notNull()
|
||||
.references(() => alertRules.alertRuleId, { onDelete: "cascade" }),
|
||||
siteId: integer("siteId")
|
||||
.notNull()
|
||||
.references(() => sites.siteId, { onDelete: "cascade" })
|
||||
});
|
||||
|
||||
export const alertHealthChecks = sqliteTable("alertHealthChecks", {
|
||||
alertRuleId: integer("alertRuleId")
|
||||
.notNull()
|
||||
.references(() => alertRules.alertRuleId, { onDelete: "cascade" }),
|
||||
healthCheckId: integer("healthCheckId")
|
||||
.notNull()
|
||||
.references(() => targetHealthCheck.targetHealthCheckId, {
|
||||
onDelete: "cascade"
|
||||
})
|
||||
});
|
||||
|
||||
export const alertEmailActions = sqliteTable("alertEmailActions", {
|
||||
emailActionId: integer("emailActionId").primaryKey({ autoIncrement: true }),
|
||||
alertRuleId: integer("alertRuleId")
|
||||
|
||||
Reference in New Issue
Block a user