DBIx::Class default column value

Having read the docs for DBIx::Class::Row new() and DBIx::Class::ResultSource add_columns() it’s hard to know whether it’s better to (a) override new() for the Result module and set a default value in the method params, or (b) use default_value in the add_columns method and set the default within the database itself.

After some investigation, (b) requires fetching the row after creating it just in case there’s a default value being added by the database. Since I already had a custom new() method to validate one of the parameters anyway, I decided to go for option (a) and add a simple check to new()

$args->{ column_name } = $default unless exists $args->{ column_name };