UnmarkAsLatest marks the current latest version of a server as no longer latest
(ctx context.Context, tx pgx.Tx, serverName string)
| 885 | |
| 886 | // UnmarkAsLatest marks the current latest version of a server as no longer latest |
| 887 | func (db *PostgreSQL) UnmarkAsLatest(ctx context.Context, tx pgx.Tx, serverName string) error { |
| 888 | if ctx.Err() != nil { |
| 889 | return ctx.Err() |
| 890 | } |
| 891 | |
| 892 | executor := db.getExecutor(tx) |
| 893 | |
| 894 | query := `UPDATE servers SET is_latest = false WHERE server_name = $1 AND is_latest = true` |
| 895 | |
| 896 | _, err := executor.Exec(ctx, query, serverName) |
| 897 | if err != nil { |
| 898 | return fmt.Errorf("failed to unmark latest version: %w", err) |
| 899 | } |
| 900 | |
| 901 | return nil |
| 902 | } |
| 903 | |
| 904 | // SetLatestVersion sets is_latest=true on the given version and false on all other versions |
| 905 | // of the same server. Passing an empty version clears is_latest for all rows. |
nothing calls this directly
no test coverage detected