Skip to content

Commit df3e65f

Browse files
adapters/sqlstore: Handle null meta for migrating users (#125)
1 parent 1ff82a3 commit df3e65f

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

adapters/sqlstore/schema.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ create table workflow_records (
88
object longblob not null,
99
created_at datetime(3) not null,
1010
updated_at datetime(3) not null,
11-
meta blob not null,
11+
meta blob,
1212

1313
primary key(run_id),
1414

adapters/sqlstore/util.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,11 @@ func recordScan(row row) (*workflow.Record, error) {
180180
return nil, errors.Wrap(err, "recordScan")
181181
}
182182

183-
err = json.Unmarshal(meta, &r.Meta)
184-
if err != nil {
185-
return nil, errors.Wrap(err, "unable to unmarshal meta for record")
183+
if len(meta) > 0 {
184+
err = json.Unmarshal(meta, &r.Meta)
185+
if err != nil {
186+
return nil, errors.Wrap(err, "unable to unmarshal meta for record")
187+
}
186188
}
187189

188190
return &r, nil

adapters/sqlstore/util_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var migrations = []string{
1919
object longblob not null,
2020
created_at datetime(3) not null,
2121
updated_at datetime(3) not null,
22-
meta blob not null,
22+
meta blob,
2323
2424
primary key(run_id),
2525

0 commit comments

Comments
 (0)