Skip to content

Commit

Permalink
feat: support tracking commit timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
sweatybridge committed Nov 8, 2024
1 parent 1becd0f commit 6746c25
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
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

0 comments on commit 6746c25

Please sign in to comment.