[Dbix-class] Regenerating schema following DBIC::Schema::Loader dump_to_dir?

Chris Cole chris at compbio.dundee.ac.uk
Tue May 26 13:00:30 GMT 2009


Denny wrote:
> On Tue, 2009-05-26 at 12:19 +0100, Chris Cole wrote:
>> Denny wrote:
>>> On Tue, 2009-05-26 at 09:21 +0100, Chris Cole wrote:
>>>> The problem seems to be that the current schema is a DBIx::Class::Schema
>>>> object, but in order to update it needs to be a
>>>> DBIx::Class::Schema::Loader object. I can modify the base class to be a
>>>> Loader object, but then the it barfs because the md5sums are different.
>>>>
>>>> I seem to be in a catch22. (I think) I need to change the files in order
>>>> to update them, but changing them stops them being updated. Help!
>>> Ah, I think you've hit the same mistake as me when I started - you're
>>> trying to generate the DB modules using your main DB module as the
>>> starting point?
>> Yes. That's right.
> 
>>From helping Chris I've just remembered exactly where I went wrong (and
> also where he seems to have gone wrong) - which was by using
> dump_to_dir(), instead of make_schema_at() combined with the
> dump_directory option.

Yup, that's exactly where my problem was. Using make_schema_at() works
seemlessly now.

> I'd like to take a stab at updating the docs for DBIC::Schema::Loader to
> make it more obvious which one to use, if people think that would be
> worthwhile?  Currently I think both the method names and the start of
> the description of make_schema_at() tend to guide you towards
> dump_to_dir() if you want to generate an on-disk copy of your schema
> from an existing database, when I think that what most people want in
> these circumstances* is probably the functionality that make_schema_at()
> + dump_directory offer.

I'd certainly agree that it was worthwhile. Re-reading the docs now
still steers me away from using make_schema_at() with the words 'rough
draft manual schema'...

Any wording to highlight how to regenerate an existing dump would be
very useful to newbies (like me).

THanks again to Denny, for his help.



More information about the DBIx-Class mailing list