[Dbix-class] Forcing might_have with dbicdump?

Dagfinn Ilmari Mannsåker ilmari at ilmari.org
Mon Oct 3 11:02:43 GMT 2016


Alex Povolotsky <tarkhil at over.ru> writes:

> Hello
>
> I have two tables, list of all images for processing (say, table images
> ( id int primary key not null)) and separate list of unprocessed images
> (added recently, due to slow search in huge table of images - say, table
> images_queue (id int not null references images(id))
>
> How can I force dbicdump to make might_have in Images.pm instead of
> default has_many?

dbicdump creates a has_many because your current schema allows multiple
image_queue rows per images row.  It will only crete a migth_have if
there can only be one, i.e. if there's a unique constraint on the
foreign key.

> Alex

Ilmari

-- 
- Twitter seems more influential [than blogs] in the 'gets reported in
  the mainstream press' sense at least.               - Matt McLeod
- That'd be because the content of a tweet is easier to condense down
  to a mainstream media article.                      - Calle Dybedahl




More information about the DBIx-Class mailing list