Wrap your column type to opt-out from dehydration by ShallowDehydrateValue,
when used by JSON functions, such as the ones used by the relational helpers.
Why need this?
An edge case surfaced in issues where a numeric string column type was actually
not a numeric data type column, but text - and thus shouldn't be dehydrated
to number.
Another use case would be, when someone finds a way to keep nested columns hydrated
at runtime, e.g. via a plugin, and wants to prevent dehydration of such columns
at the type level.
In the example above, "a_column" will be dehydrated to number
given it is a numeric string - which is normally a numeric data type column
that gets output as a string by underlying database drivers to avoid
precision loss or overflow.
"another_column" and "column_too" will remain as '1' | '2' | '3', given they're
wrapped in NonDehydrateable, which prevents their dehydration.
Wrap your column type to opt-out from dehydration by ShallowDehydrateValue, when used by JSON functions, such as the ones used by the relational helpers.
Why need this?
An edge case surfaced in issues where a numeric string column type was actually not a numeric data type column, but text - and thus shouldn't be dehydrated to
number.Another use case would be, when someone finds a way to keep nested columns hydrated at runtime, e.g. via a plugin, and wants to prevent dehydration of such columns at the type level.
Examples
In the example above, "a_column" will be dehydrated to
numbergiven it is a numeric string - which is normally a numeric data type column that gets output as a string by underlying database drivers to avoid precision loss or overflow."another_column" and "column_too" will remain as
'1' | '2' | '3', given they're wrapped inNonDehydrateable, which prevents their dehydration.