Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

__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...?

Replies are listed 'Best First'.
Re: __PACKAGE__->add_columns( all! ) in DBIx::Class ?
by arnaud99 (Beadle) on Mar 08, 2013 at 14:59 UTC


    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.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1022427]
Approved by kcott
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2018-05-27 22:40 GMT
Find Nodes?
    Voting Booth?