Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support tracking commit timestamp #2848

Merged
merged 1 commit into from
Nov 8, 2024
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
9 changes: 5 additions & 4 deletions internal/postgresConfig/update/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ func Run(ctx context.Context, projectRef string, values []string, replaceOverrid
for k, v := range newConfigOverrides {
// this is hacky - if we're able to convert the value to an integer, we do so
// if we start supporting config fields with e.g. floating pt overrides this'll need to be updated
attemptedConvert, err := strconv.Atoi(v)
if err != nil {
finalOverrides[k] = v
if vInt, err := strconv.Atoi(v); err == nil {
finalOverrides[k] = vInt
} else if vBool, err := strconv.ParseBool(v); err == nil {
finalOverrides[k] = vBool
} else {
finalOverrides[k] = attemptedConvert
finalOverrides[k] = v
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/config/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type (
SessionReplicationRole *SessionReplicationRole `toml:"session_replication_role"`
SharedBuffers *string `toml:"shared_buffers"`
StatementTimeout *string `toml:"statement_timeout"`
TrackCommitTimestamp *bool `toml:"track_commit_timestamp"`
WalKeepSize *string `toml:"wal_keep_size"`
WalSenderTimeout *string `toml:"wal_sender_timeout"`
WorkMem *string `toml:"work_mem"`
Expand Down Expand Up @@ -104,6 +105,7 @@ func (a *settings) ToUpdatePostgresConfigBody() v1API.UpdatePostgresConfigBody {
body.MaxWalSize = a.MaxWalSize
body.SessionReplicationRole = (*v1API.UpdatePostgresConfigBodySessionReplicationRole)(a.SessionReplicationRole)
body.StatementTimeout = a.StatementTimeout
body.TrackCommitTimestamp = a.TrackCommitTimestamp
body.WalKeepSize = a.WalKeepSize
body.WalSenderTimeout = a.WalSenderTimeout
body.WorkMem = a.WorkMem
Expand Down Expand Up @@ -131,6 +133,7 @@ func (a *settings) fromRemoteConfig(remoteConfig v1API.PostgresConfigResponse) s
result.SessionReplicationRole = (*SessionReplicationRole)(remoteConfig.SessionReplicationRole)
result.SharedBuffers = remoteConfig.SharedBuffers
result.StatementTimeout = remoteConfig.StatementTimeout
result.TrackCommitTimestamp = remoteConfig.TrackCommitTimestamp
result.WalKeepSize = remoteConfig.WalKeepSize
result.WalSenderTimeout = remoteConfig.WalSenderTimeout
result.WorkMem = remoteConfig.WorkMem
Expand Down