diff --git a/internal/postgres/core/table.go b/internal/postgres/core/table.go index c71f2f230..9e8c17bb0 100644 --- a/internal/postgres/core/table.go +++ b/internal/postgres/core/table.go @@ -120,7 +120,7 @@ type existsResponse struct { func (p *Postgres) TablesExist(ctx context.Context) bool { for _, table := range models.AllDocuments() { var exists existsResponse - err := p.DB.QueryRow(tableExistsQuery, p.schema, table).Scan(&exists) + err := p.DB.NewRaw(tableExistsQuery, p.schema, table).Scan(ctx, &exists) if !exists.Flag || err != nil { return false } diff --git a/internal/postgres/tests/general_test.go b/internal/postgres/tests/general_test.go new file mode 100644 index 000000000..18c7ccdf6 --- /dev/null +++ b/internal/postgres/tests/general_test.go @@ -0,0 +1,14 @@ +package tests + +import ( + "context" + "time" +) + +func (s *StorageTestSuite) TestTableExists() { + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() + + exists := s.storage.TablesExist(ctx) + s.Require().True(exists) +}