[Dbix-class] Unwanted has_many in auto-generated schema

Bill Crawford billcrawford1970 at gmail.com
Thu Aug 19 11:37:58 GMT 2010


I'm trying to add a "current order id" column to our "users" table, as
a (nullable) foreign key to "orders". This works fine, although adding
it to the schema is fun (can't put the constraint in the table
definition due to the circular references :o)).

However, the schema loader creates a "has_many" for "users" on the
orders table due to the foreign key. The order can only belong to one
user (has a foreign key and everything already) so I can't understand
why I get this:

__PACKAGE__->has_many(
  "users",
  "SPL3::Schema::Result::User",
  { "foreign.current_order_id" => "self.id" },
  {},
);

given I already have:

__PACKAGE__->belongs_to("user", "SPL3::Schema::Result::User", { id =>
"user_id" }, {});

in the same result class?



More information about the DBIx-Class mailing list