Skip to content

Commit

Permalink
feat: Update archived workdflow column to be JSON. Closes argoproj#2133
Browse files Browse the repository at this point in the history
  • Loading branch information
alexec authored Feb 4, 2020
1 parent f591c47 commit 8a1e611
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion persist/sqldb/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (m migrate) Exec(ctx context.Context) error {
ansiSQLChange(`alter table argo_archived_workflows add primary key(clustername,uid)`),
ansiSQLChange(`create index argo_archived_workflows_i1 on argo_archived_workflows (clustername,namespace)`),
// argo_archived_workflows now looks like:
// clustername(not null) uid(not null) | phase(not null) | namespace(not null) | workflow(not null) | startedat(not null) | finishedat(not null)
// clustername(not null) | uid(not null) | | name (null) | phase(not null) | namespace(not null) | workflow(not null) | startedat(not null) | finishedat(not null)
// remove unused columns
ansiSQLChange(`alter table ` + m.tableName + ` drop column phase`),
ansiSQLChange(`alter table ` + m.tableName + ` drop column startedat`),
Expand Down Expand Up @@ -192,6 +192,15 @@ func (m migrate) Exec(ctx context.Context) error {
ansiSQLChange(`create index ` + m.tableName + `_i1 on ` + m.tableName + ` (clustername,namespace)`),
// argo_workflows now looks like:
// clustername(not null) | uid(not null) | namespace(not null) | version(not null) | nodes(not null) | updatedat(not null)
ternary(dbType == "mysql",
ansiSQLChange(`alter table argo_archived_workflows modify column workflow json not null`),
ansiSQLChange(`alter table argo_archived_workflows alter column workflow type json using workflow::json`),
),
ternary(dbType == "mysql",
ansiSQLChange(`alter table argo_archived_workflows modify column name varchar(256) not null`),
ansiSQLChange(`alter table argo_archived_workflows alter column name set not null`),
),
// clustername(not null) | uid(not null) | | name (not null) | phase(not null) | namespace(not null) | workflow(not null) | startedat(not null) | finishedat(not null)
} {
err := m.applyChange(ctx, changeSchemaVersion, change)
if err != nil {
Expand Down

0 comments on commit 8a1e611

Please sign in to comment.