[Dbix-class] deploying schemas
Brandon Black
blblack at gmail.com
Thu Apr 26 05:27:20 GMT 2007
On 4/25/07, Octavian Rasnita <orasnita at gmail.com> wrote:
> Hi,
>
> I have created a class of DBIx::Class modules using the Catalyst helper
> DBIC::Schema.
> The created modules work well, but I have tried to deploy them into another
> database without success.
>
> For example, in a database table I have a date field, and DBIC::Schema
> helper module exported it with the following parameter:
>
> size => 10,
>
> So when I have tried to deploy the module, it tried to create an SQL like
> this:
>
> date DATE(10) NOT NULL DEFAULT '0000-00-00',
>
> ...which is not correct and it gave errors.
>
> It also tried to do things like:
>
> created datetime(19),
> time TIME(8) NOT NULL DEFAULT '',
> trimestru ENUM() NOT NULL DEFAULT '',
>
> Is there another method to create the modules automaticly using DBIC::Schema
> Catalyst helper or something else, or the only secure method is to edit the
> modules manually?
>
The schema files generated for you by the Helper are generated by
DBIx::Class::Schema::Loader. The ->deploy() support comes in via
SQL::Translator. Honestly, I'm not surprised that the round-trip
through both modules resulted in failure. There's not a whole lot of
standardization across the two modules with regard to the exact
definition of the column metadata fields and data types, even within
the realm of a single database vendor.
We could work to improve this in the long term. What would be most
helpful would be specific examples of badly-roundtripped column
definitions for a given vendor, and what they should have looked like
in order to be correct. Then we can get to figuring out whether each
case is a question of Loader not interpreting the database correctly,
a disagreement on column metadata standards, or ->deploy not writing
it out correctly.
In the short term, you're probably best off fixing it yourself by
editing the files though, sorry.
-- Brandon
More information about the Dbix-class
mailing list