[Dbix-class] nullable column and might_have

Mitchell Elutovich melutovich at gmail.com
Thu Jun 5 11:54:41 GMT 2014


I have something like the following on a custom result source

__PACKAGE__->add_columns(
  "xxxid",
  { data_type => "INT", default_value => undef, is_nullable => 1, size =>
11 },
);

__PACKAGE__->might_have(
  "xxxd",
  "ForeignClass",
  { "foreign.id" => "self.xxxid" },
);

I'm getting the warning:

DBIx::Class::Relationship::HasOne::_validate_has_one_condition():
"might_have/has_one" must not be on columns with is_nullable set to true
(MyClass/xxxid). This might indicate an incorrect use of those relationship
helpers instead of belongs_to. at ...

I don't understand why this for might_have might be incorrect, doesn't
might_have imply it might be null?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20140605/4f2189c4/attachment.htm>


More information about the DBIx-Class mailing list