diff --git a/persist/sqldb/migrate.go b/persist/sqldb/migrate.go index 45c908cc87de..193b20ccb887 100644 --- a/persist/sqldb/migrate.go +++ b/persist/sqldb/migrate.go @@ -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 @@ -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. #13601 + 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 {