[Dbix-class] Using DBIx::Class::Schema::Config with dbicdump

Janne Snabb snabb at epipe.com
Fri Sep 30 05:39:31 GMT 2011


Symkat, Thank You for the excellent DBIx::Class::Schema::Config

I just started using DBIx::Class in first project and this module
seems to be the most sensible solution for keeping the DB credentials
configuration separate from the code in an application which does
not require any other configuration.

There is however one thing that irritates me:

I am using dbicdump to create and update my DBIC schema from the
database schema. It creates a Schema.pm with the following line in it:

use base 'DBIx::Class::Schema';

...which I have to change to:

use base 'DBIx::Class::Schema::Config';

...to use this module.

Unfortunately this line happens to be in the "DO NOT MODIFY THE
FIRST PART OF THIS FILE" section of Schema.pm. Thus if I modify it,
I need to change it back to the original every time I want to update
the DBIC schema to reflect changes in the database. Otherwise
dbicdump just aborts and refuses to implement any changes.

Does anyone have good suggestions how to avoid this problem?

If there is some reasonable workaround or trick which can be used
to avoid this problem, it would be a good idea to add that to the
DBIx::Class::Schema::Config module documentation.

Currently I am just using an editor to revert the offending but
important line back to the original before running dbicdump. I wish
there was a better way to do this (such as somehow enabling the
module later in Schema.pm so that it stays out of the autogenerated

Janne Snabb / EPIPE Communications
snabb at epipe.com - http://epipe.com/

More information about the DBIx-Class mailing list