Skip to content

Commit

Permalink
Use current_schema instead of public when checking for table existence (
Browse files Browse the repository at this point in the history
  • Loading branch information
mgdelacroix authored Apr 17, 2024
1 parent a96acd1 commit 0253e60
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion server/store/sqlstore/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func (s *SQLStore) indexExist(tableName, indexName string) (bool, error) {
}

func (s *SQLStore) tableExist(tableName string) (bool, error) {
rows, err := s.db.Query(fmt.Sprintf("SELECT 1 FROM pg_tables WHERE schemaname = 'public' AND tablename = '%s'", tableName))
rows, err := s.db.Query(fmt.Sprintf("SELECT 1 FROM pg_tables WHERE schemaname = current_schema() AND tablename = '%s'", tableName))
if err != nil {
return false, err
}
Expand Down

0 comments on commit 0253e60

Please sign in to comment.