Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion service/pkg/db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func (c Config) buildConfig() (*pgxpool.Config, error) {

// Configure the search_path schema immediately on connection opening
parsed.AfterConnect = func(ctx context.Context, conn *pgx.Conn) error {
_, err := conn.Exec(ctx, "SET search_path TO "+c.Schema)
_, err := conn.Exec(ctx, "SET search_path TO "+pgx.Identifier{c.Schema}.Sanitize())
if err != nil {
slog.Error("failed to set database client search_path",
slog.String("schema", c.Schema),
Expand Down
3 changes: 2 additions & 1 deletion service/pkg/db/db_migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"log/slog"

"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgxpool"
"github.com/jackc/pgx/v5/stdlib"
"github.com/pressly/goose/v3"
Expand Down Expand Up @@ -57,7 +58,7 @@ func (c *Client) RunMigrations(ctx context.Context, migrations *embed.FS) (int,
)

// Create schema if it doesn't exist
q := "CREATE SCHEMA IF NOT EXISTS " + c.config.Schema
q := "CREATE SCHEMA IF NOT EXISTS " + pgx.Identifier{c.config.Schema}.Sanitize()
tag, err := c.Pgx.Exec(ctx, q)
if err != nil {
slog.ErrorContext(ctx,
Expand Down
Loading