Skip to content

Fix `null` handling of publication state in changeset_specs

Administrator requested to merge es/fix-changeset-spec-read into main

Created by: eseliger

This didn't fully work, it kinda by accident worked with new data, but it doesn't work with existing, migrated data (which is actually in the correct shape).

The problem: We marshalled anything to json, regardless if the value was unset (nil). That writes 'null' to the column (the string value null). Then, when we scan the changeset spec, that happily passes as 'null' is a valid json string, it unmarshals into nil, just as desired. This isn't very clean though. However: Existing values have been written as NULL (the literal) in the migration. Those are []byte{} and cannot be interpreted as json. This PR fixes marshalling null as proper NULL literals and also fixes unmarshalling. Next release we can run a quick migration to consolidate the state again.

Test plan

Verified the observed error disappeared.

Merge request reports

Loading