Closed mikedonnici closed 5 years ago
Found a better solution... can use IFNULL()
in MySQL.
For example:
SELECT IFNULL(type_id, 0) FROM foo;
If type_id
is NULL
then the expression will return 0 instead.
This is much nicer than sqlNullInt64
Changed in 75d0f14.
When databases was updated to include activity types
ce_activity_type_id
field was added to thece_m_activity
table. All new records should have a value for this field however older records will have this field set to NULL.To accommodate this the
ActivityType.ID
was set to use a special typesql.NullInt64
which is a struct.In hindsight, this was a bad idea as the
sql.NullInt64
is much harder to handle in the code than a straightforwardint
. This came to light whilst trying to set up integration tests for theinternal/activity
package (#32).Setting old values to
0
might be a much easier way to deal with this problem.At this stage, the GraphQL server is the only part of the application that accesses this type.
int
and check how it behaves