diff --git a/.gitignore b/.gitignore index 1e7c54b..407e20d 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,4 @@ testdata/docker-test/testout.json testdata/docker-test/testout.html ./gopogh cmd/gopogh-server/gopogh-server -.vscode \ No newline at end of file +.vscode/ \ No newline at end of file diff --git a/pkg/db/postgres.go b/pkg/db/postgres.go index f9af77e..301d564 100644 --- a/pkg/db/postgres.go +++ b/pkg/db/postgres.go @@ -150,8 +150,15 @@ func (m *Postgres) createMaterializedView(env string, viewName string) error { WHERE Result != 'skip' AND EnvName = '%s' AND TestTime >= NOW() - INTERVAL '90 days' `, viewName, env) - _, err := m.db.Exec(createView) - return err + if _, err := m.db.Exec(createView); err != nil { + return err + } + // refresh the materialzed view + refreshView := fmt.Sprintf("REFRESH MATERIALIZED VIEW %s ;", viewName) + if _, err := m.db.Exec(refreshView); err != nil { + return err + } + return nil } // GetTestCharts writes the individual test chart data to a map with the keys flakeByDay and flakeByWeek