[Catalyst] Re: recommendation
Octavian Rasnita
orasnita at gmail.com
Mon Nov 10 19:40:13 GMT 2008
From: "kevin montuori" <montuori at gmail.com>
>>>>>> "OR" == Octavian Rasnita <orasnita at gmail.com> writes:
>
> OR> Especially for a beginner, but not only, the most simple way of
> OR> creating the DBIC classes for a Catalyst app is to use the
> OR> DBIC::Schema helper.
>
> although it's not what you asked, i'll comment that i've had great luck
> doing this the other way round: i write the classes (with a lot of help
> from an emacs template*) and generate a DDL script from those. in
> addition to making table creation trivial, sqlt-diff produces scripts
> which (usually) do a fine job of upgrading from one version to another.
>
> see create_ddl_dir() here: http://tinyurl.com/5vgwcj and sqlt-diff here:
> http://tinyurl.com/6ql6wo for details.
>
> i'm much better at writing perl classes than DDL though, so it was
> obvious that this was the right thing for me in a 50 table, 10 view
> database. no doubt your mileage will vary.
>
>
> k.
This could be also a good solution, but unfortunately it gives so many
errors that it would be more simple to update the DBIC classes manually.
I've just tried create_ddl_dir again to see if it works better now, but I
needed to make more tens of corrections for a database with only 10 simple
tables.
The main problem is that the DBIC class files as they are now, are harder to
update automaticly. It would be nice if the information about tables and
their columns would be kept in separate files than the rest of the code. In
that way, the code could get the information about tables from those
separate files (when using create=static) or even from the database when
using create=dynamic.
Such an interface would be much flexible, but I don't even know if it is
possible to do it...
Octavian
More information about the Catalyst
mailing list