What many of us do, probably most of the experienced Cat devs, is to keep the schema separate from the Cat app, though often in the same namespace. So you have MyApp::Schema and MyApp::Schema::Tables or MyApp::Schema::FatModel and then your model class is nothing but an import of the schema with some connection information for the application.

package MyApp::Model::DB; use strict; use base qw/ Catalyst::Model::DBIC::Schema /; __PACKAGE__->config ( schema_class => 'MyApp::Schema', # et cetera

It can be confusing at first because the abstractions are pretty deep but it's very powerful and lets you reuse your schema anywhere (command line, standalone service, one-offs) without loading your app since it ignores anything outside the M/V/C namespaces.


In reply to Re: Best Practice: Catalyst and DBIx::Class by Your Mother
in thread Best Practice: Catalyst and DBIx::Class by confused_elf

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.