[Dbix-class] How to use filename with ->deploy
Emmanuel Quevillon
tuco at pasteur.fr
Wed Oct 20 09:07:50 GMT 2010
On 10/18/10 11:46 AM, Leandro Hermida wrote:
> Hi,
>
> If you already have a SQL DDL file to create your schema why bother
> with DBIx::Class's deploy method? Just do something like
>
> system(''psql -f $sqlfile $dbname'') == 0 or die "Failed, exit code:
> ", $?>> 8, "\n";
>
> From what I understand (and use it for) the deploy method is if you
> have all your DBIx::Class result class files defined with
> relationships and all appropriate column info, e.g.
>
> __PACKAGE__->add_columns(albumid =>
> { accessor => 'album',
> data_type => 'integer',
> size => 16,
> is_nullable => 0,
> is_auto_increment => 1,
> default_value => '',
> },
>
> it will analyze these file and *automatically* generate the approriate
> SQL DDL for the target DBMS (PgSQL, MySQL, Oracle, etc.). It works
> really well and you can have just one "schema definition" for your
> project (instead of a SQL DDL file for each DBMS you might deploy to)
> and let DBIx::Class (and SQL::Translator) figure out how to properly
> map that to the DBMS.
>
> hth,
> Leandro
>
Hi Leandro
I followed your advice and refined my Schema::* modules to fit with my
needs. And the database created using ->deploy() is what I want.
Thanks a lot
Emmanuel
More information about the DBIx-Class
mailing list