[Catalyst] Re: recommendation
orasnita at gmail.com
Sun Nov 16 07:17:28 GMT 2008
From: "Matt S Trout" <dbix-class at trout.me.uk>
> On Mon, Nov 10, 2008 at 09:40:13PM +0200, Octavian Rasnita wrote:
>> >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.
>> 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
> This approach *is* best practice and it *does* work fine for SQLite, MySQL
> and Postgres at least.
I am very glad to hear this.
> If you need to make tens of corrections, one of two things is happening:
> (1) you've found a bug and should have reported it but didn't
I've reported a very long time ago but nothing happend. But maybe I am doing
I remember the following types of errors (for MySQL 5):
The date field used to get a field size which is not correct, like:
and the enum() field doesn't remember the field elements.
The field elements for enum field types are not saved in the DBIC class file
when the classes are created using the Catalyst helper.
So when the SQL string is re-created, it looks something like:
which of course, gives an error when trying to update the database.
> (2) you did something wrong
> Either way, please get on the dbix-class list and report what code you
> and we can tell you which it is.
Ok, I will try to write again to DBIx::Class mailing list. I hope my
messages will reach the list(s) because in the last few weeks, many messages
are rejected from both DBIC and Catalyst mailing lists.
> ->deploy *is* best practice, it *does* work and it's going to be marked
> non-experimental for 08100.
Good news! Thank you.
More information about the Catalyst