Skip to content

Commit

Permalink
Set max connections for plan cmd (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
bplunkett-stripe authored Jan 25, 2024
1 parent 266b6bd commit 75764a0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cmd/pg-schema-diff/plan_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ func generatePlan(ctx context.Context, logger log.Logger, connConfig *pgx.ConnCo
}
defer connPool.Close()

connPool.SetMaxOpenConns(5)

plan, err := diff.GeneratePlan(ctx, connPool, tempDbFactory, ddl,
diff.WithDataPackNewTables(),
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/diff/plan_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func WithLogger(logger log.Logger) PlanOpt {
//
// Parameters:
// queryable: The target database to generate the diff for. It is recommended to pass in *sql.DB of the db you
// wish to migrate.
// wish to migrate. If using a connection pool, it is RECOMMENDED to set a maximum number of connections.
// tempDbFactory: used to create a temporary database instance to extract the schema from the new DDL and validate the
// migration plan. It is recommended to use tempdb.NewOnInstanceFactory, or you can provide your own.
// newDDL: DDL encoding the new schema
Expand Down

0 comments on commit 75764a0

Please sign in to comment.