Skip to content

Commit

Permalink
fix!: migrate argo_archived_workflows.workflow to jsonb (#13779)
Browse files Browse the repository at this point in the history
Signed-off-by: Mason Malone <[email protected]>
  • Loading branch information
MasonM authored Oct 24, 2024
1 parent bb5130e commit 92bf975
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions persist/sqldb/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ type change interface {
apply(session db.Session) error
}

type noop struct{}

func (s noop) apply(session db.Session) error {
return nil
}

func ternary(condition bool, left, right change) change {
if condition {
return left
Expand Down Expand Up @@ -258,6 +264,11 @@ func (m migrate) Exec(ctx context.Context) (err error) {
// add indexes for list archived workflow performance. #8836
ansiSQLChange(`create index argo_archived_workflows_i4 on argo_archived_workflows (startedat)`),
ansiSQLChange(`create index argo_archived_workflows_labels_i1 on argo_archived_workflows_labels (name,value)`),
// PostgreSQL only: convert argo_archived_workflows.workflow column to JSONB for performance and consistency with MySQL. #13779
ternary(dbType == MySQL,
noop{},
ansiSQLChange(`alter table argo_archived_workflows alter column workflow set data type jsonb using workflow::jsonb`),
),
} {
err := m.applyChange(changeSchemaVersion, change)
if err != nil {
Expand Down

0 comments on commit 92bf975

Please sign in to comment.