Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

__PACKAGE__->add_columns( all! ) in DBIx::Class ?

by tomgracey (Beadle)
on Mar 08, 2013 at 13:57 UTC ( #1022427=perlquestion: print w/ replies, xml ) Need Help??
tomgracey has asked for the wisdom of the Perl Monks concerning the following question:

Dear fountains of perl knowledge

I have been making DBIx::Class packages and writing

__PACKAGE__->table('mytable'); __PACKAGE__->add_columns(qw/column1 column2 column3... /);

I am wondering... what if I simply want to include all of the table columns? Is there not a shorthand?

I couldnt find any reference to this anywhere - which usually means I have the basic concepts wrong...?

Comment on __PACKAGE__->add_columns( all! ) in DBIx::Class ?
Download Code
Re: __PACKAGE__->add_columns( all! ) in DBIx::Class ?
by arnaud99 (Beadle) on Mar 08, 2013 at 14:59 UTC

    Hi

    If you already have the schema created in your database you can use DBIx::Class::Schema::Loader.

    You can run this from the command line by using the dbicdump script

    If you run something like dbicdump -o dump_directory=lib MyApp::Schema $dns $user $pass

    then your classes will be created under the lib/MyApp/Schema/Result directory

    For more info you can use perldoc dbicdump.

    hope this helps.

    Arnaud.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1022427]
Approved by kcott
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2015-07-07 08:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (88 votes), past polls