[Dbix-class] Question about dynamic class generation (DBIx::Class::Schema::Loader)

castaway at desert-island.demon.co.uk castaway at desert-island.demon.co.uk
Tue Feb 14 10:59:53 CET 2006


On Tue, 7 Feb 2006, Brandon Black wrote:

> run in a big app with a big/complex database schema (in development or
> production - just in general).  It's purpose is to get people up and
> running quickly against an existing database that wasn't built with
> DBIx::Class in mind, or is created/managed by other tools at the time.

I just went "huh?" here.. What is different about a DB that's been 
designed with DBIx::Class in mind? Or did you just mean "properly 
normalised" ?

> It tries to divine the ideal DBIx::Class::Schema setup based on what
> it can see on your live running database server, but it cannot
> possibly get it all correct - it will always be just a good
> approximation of what you might have done if you defined the Schema
> manually when it comes to relationships and such.
>
> [I think I've written the above in some form like 4 times now to
> various people, perhaps I should patch that into the Schema::Loader
> documentation?]

Great idea! ;)

> Unless your app/db is fairly simplistic, you will probably want to
> migrate off of Schema::Loader after a while, and you'd do that by
> using the DBIx::Class SQLT support to dump the
> Schema::Loader-generated Schema out to a manual definition that you
> can edit and refine from there.

IMO (and I may be off base), it should be possible to use Loader, which 
will have a standard set of predictable results (which should be detailed 
in the docs), and then only write your own classes for the parts you need 
to change / expand. Some flag should possibly set whether the user-created 
classes replace or extend the Loader ones .. ?

Jess




More information about the Dbix-class mailing list