mirror of
https://github.com/TwiN/gatus.git
synced 2025-01-10 16:08:29 +01:00
Fix indentation
This commit is contained in:
parent
97dd868ae8
commit
cf48072167
@ -78,11 +78,11 @@ func NewStore(driver, path string) (*Store, error) {
|
|||||||
func (s *Store) createSchema() error {
|
func (s *Store) createSchema() error {
|
||||||
_, err := s.db.Exec(`
|
_, err := s.db.Exec(`
|
||||||
CREATE TABLE IF NOT EXISTS service (
|
CREATE TABLE IF NOT EXISTS service (
|
||||||
service_id INTEGER PRIMARY KEY,
|
service_id INTEGER PRIMARY KEY,
|
||||||
service_key TEXT UNIQUE,
|
service_key TEXT UNIQUE,
|
||||||
service_name TEXT,
|
service_name TEXT,
|
||||||
service_group TEXT,
|
service_group TEXT,
|
||||||
UNIQUE(service_name, service_group)
|
UNIQUE(service_name, service_group)
|
||||||
)
|
)
|
||||||
`)
|
`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -90,8 +90,8 @@ func (s *Store) createSchema() error {
|
|||||||
}
|
}
|
||||||
_, err = s.db.Exec(`
|
_, err = s.db.Exec(`
|
||||||
CREATE TABLE IF NOT EXISTS service_event (
|
CREATE TABLE IF NOT EXISTS service_event (
|
||||||
service_event_id INTEGER PRIMARY KEY,
|
service_event_id INTEGER PRIMARY KEY,
|
||||||
service_id INTEGER REFERENCES service(service_id) ON DELETE CASCADE,
|
service_id INTEGER REFERENCES service(service_id) ON DELETE CASCADE,
|
||||||
event_type TEXT,
|
event_type TEXT,
|
||||||
event_timestamp TIMESTAMP
|
event_timestamp TIMESTAMP
|
||||||
)
|
)
|
||||||
@ -101,18 +101,18 @@ func (s *Store) createSchema() error {
|
|||||||
}
|
}
|
||||||
_, err = s.db.Exec(`
|
_, err = s.db.Exec(`
|
||||||
CREATE TABLE IF NOT EXISTS service_result (
|
CREATE TABLE IF NOT EXISTS service_result (
|
||||||
service_result_id INTEGER PRIMARY KEY,
|
service_result_id INTEGER PRIMARY KEY,
|
||||||
service_id INTEGER REFERENCES service(service_id) ON DELETE CASCADE,
|
service_id INTEGER REFERENCES service(service_id) ON DELETE CASCADE,
|
||||||
success INTEGER,
|
success INTEGER,
|
||||||
errors TEXT,
|
errors TEXT,
|
||||||
connected INTEGER,
|
connected INTEGER,
|
||||||
status INTEGER,
|
status INTEGER,
|
||||||
dns_rcode TEXT,
|
dns_rcode TEXT,
|
||||||
certificate_expiration INTEGER,
|
certificate_expiration INTEGER,
|
||||||
hostname TEXT,
|
hostname TEXT,
|
||||||
ip TEXT,
|
ip TEXT,
|
||||||
duration INTEGER,
|
duration INTEGER,
|
||||||
timestamp TIMESTAMP
|
timestamp TIMESTAMP
|
||||||
)
|
)
|
||||||
`)
|
`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -120,10 +120,10 @@ func (s *Store) createSchema() error {
|
|||||||
}
|
}
|
||||||
_, err = s.db.Exec(`
|
_, err = s.db.Exec(`
|
||||||
CREATE TABLE IF NOT EXISTS service_result_condition (
|
CREATE TABLE IF NOT EXISTS service_result_condition (
|
||||||
service_result_condition_id INTEGER PRIMARY KEY,
|
service_result_condition_id INTEGER PRIMARY KEY,
|
||||||
service_result_id INTEGER REFERENCES service_result(service_result_id) ON DELETE CASCADE,
|
service_result_id INTEGER REFERENCES service_result(service_result_id) ON DELETE CASCADE,
|
||||||
condition TEXT,
|
condition TEXT,
|
||||||
success INTEGER
|
success INTEGER
|
||||||
)
|
)
|
||||||
`)
|
`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -131,13 +131,13 @@ func (s *Store) createSchema() error {
|
|||||||
}
|
}
|
||||||
_, err = s.db.Exec(`
|
_, err = s.db.Exec(`
|
||||||
CREATE TABLE IF NOT EXISTS service_uptime (
|
CREATE TABLE IF NOT EXISTS service_uptime (
|
||||||
service_uptime_id INTEGER PRIMARY KEY,
|
service_uptime_id INTEGER PRIMARY KEY,
|
||||||
service_id INTEGER REFERENCES service(service_id) ON DELETE CASCADE,
|
service_id INTEGER REFERENCES service(service_id) ON DELETE CASCADE,
|
||||||
hour_unix_timestamp INTEGER,
|
hour_unix_timestamp INTEGER,
|
||||||
total_executions INTEGER,
|
total_executions INTEGER,
|
||||||
successful_executions INTEGER,
|
successful_executions INTEGER,
|
||||||
total_response_time INTEGER,
|
total_response_time INTEGER,
|
||||||
UNIQUE(service_id, hour_unix_timestamp)
|
UNIQUE(service_id, hour_unix_timestamp)
|
||||||
)
|
)
|
||||||
`)
|
`)
|
||||||
return err
|
return err
|
||||||
@ -428,8 +428,8 @@ func (s *Store) updateServiceUptime(tx *sql.Tx, serviceID int64, result *core.Re
|
|||||||
VALUES ($1, $2, $3, $4, $5)
|
VALUES ($1, $2, $3, $4, $5)
|
||||||
ON CONFLICT(service_id, hour_unix_timestamp) DO UPDATE SET
|
ON CONFLICT(service_id, hour_unix_timestamp) DO UPDATE SET
|
||||||
total_executions = excluded.total_executions + total_executions,
|
total_executions = excluded.total_executions + total_executions,
|
||||||
successful_executions = excluded.successful_executions + successful_executions,
|
successful_executions = excluded.successful_executions + successful_executions,
|
||||||
total_response_time = excluded.total_response_time + total_response_time
|
total_response_time = excluded.total_response_time + total_response_time
|
||||||
`,
|
`,
|
||||||
serviceID,
|
serviceID,
|
||||||
unixTimestampFlooredAtHour,
|
unixTimestampFlooredAtHour,
|
||||||
@ -723,13 +723,13 @@ func (s *Store) deleteOldServiceEvents(tx *sql.Tx, serviceID int64) error {
|
|||||||
`
|
`
|
||||||
DELETE FROM service_event
|
DELETE FROM service_event
|
||||||
WHERE service_id = $1
|
WHERE service_id = $1
|
||||||
AND service_event_id NOT IN (
|
AND service_event_id NOT IN (
|
||||||
SELECT service_event_id
|
SELECT service_event_id
|
||||||
FROM service_event
|
FROM service_event
|
||||||
WHERE service_id = $1
|
WHERE service_id = $1
|
||||||
ORDER BY service_event_id DESC
|
ORDER BY service_event_id DESC
|
||||||
LIMIT $2
|
LIMIT $2
|
||||||
)
|
)
|
||||||
`,
|
`,
|
||||||
serviceID,
|
serviceID,
|
||||||
core.MaximumNumberOfEvents,
|
core.MaximumNumberOfEvents,
|
||||||
@ -748,13 +748,13 @@ func (s *Store) deleteOldServiceResults(tx *sql.Tx, serviceID int64) error {
|
|||||||
`
|
`
|
||||||
DELETE FROM service_result
|
DELETE FROM service_result
|
||||||
WHERE service_id = $1
|
WHERE service_id = $1
|
||||||
AND service_result_id NOT IN (
|
AND service_result_id NOT IN (
|
||||||
SELECT service_result_id
|
SELECT service_result_id
|
||||||
FROM service_result
|
FROM service_result
|
||||||
WHERE service_id = $1
|
WHERE service_id = $1
|
||||||
ORDER BY service_result_id DESC
|
ORDER BY service_result_id DESC
|
||||||
LIMIT $2
|
LIMIT $2
|
||||||
)
|
)
|
||||||
`,
|
`,
|
||||||
serviceID,
|
serviceID,
|
||||||
core.MaximumNumberOfResults,
|
core.MaximumNumberOfResults,
|
||||||
|
Loading…
Reference in New Issue
Block a user