[Dbix-class] Oracle AutoPK and Sequencies

Jason Gottshall jgottshall at capwiz.com
Mon Jun 15 19:58:33 GMT 2009


Johnny Gebreselassie wrote:
> The values for sequence and auto_nextval need to be specified on the 
> primary_key column as shown in this copied documentation:
>    "->add_columns({ id => { sequence => 'mysequence', auto_nextval => 1
>    } });"
> 
> Also if I look at the docs for PK::Auto there is a method called 
> sequence, which does something else, I am not quite sure what:
> http://search.cpan.org/~ribasushi/DBIx-Class-0.08102/lib/DBIx/Class/PK/Auto.pm 

Looks like "->sequence($seqname)" is a shortcut for setting the 
'sequence' column_info attribute on the column(s) defined by 
"->set_primary_key(@pkcols)". So if you define the sequence during the 
call to ->add_columns() (as above), you really don't need to call 
->sequence() as well.

Incidentally, I'm wondering if one should also be setting 
"is_auto_increment => 1" in this situation...

-- 
Jason Gottshall
jgottshall at capwiz.com




More information about the DBIx-Class mailing list