Forcing might_have with dbicdump?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Forcing might_have with dbicdump?

Alex Povolotsky
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?

Alex

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Forcing might_have with dbicdump?

Dagfinn Ilmari Mannsåker
Alex Povolotsky <[hidden email]> 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


_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Forcing might_have with dbicdump?

Alex Povolotsky
Ok, thank you, it's clear now

On 03.10.2016 14:02, Dagfinn Ilmari Mannsåker wrote:

> Alex Povolotsky <[hidden email]> 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
>

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Loading...