Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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

by tomgracey (Scribe)
on Mar 08, 2013 at 13:57 UTC ( [id://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

    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
Domain Nodelet?
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?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (2)
As of 2024-04-19 20:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found