[Dbix-class] DBIx::Class::Schema->deploy and DB views.

Jess Robinson castaway at desert-island.me.uk
Sat Mar 14 08:48:04 GMT 2009


Hi Kevin,

On Mon, 23 Feb 2009, kevin montuori wrote:

>
> hi all -- i have a couple questions about using DBIC::Schema->deploy
> and views:
>
> first, i'be been defining views in the schema just like i would any
> other table then adding a $sqlt_schema->drop_table("view name") to the
> sqlt_deploy_hook().  is this ok or is there a best practice here that
> i'm ignoring?

No, that's fine. In the next release however, you will be able to properly 
teach DBIx::Class about your views, it will also be able to create the 
view in your database for you.

> second, if i define a relationship between a real table and a view a
> foreign key constraint is created when i run deploy().  this isn't
> unexpected but it is problematic.  i'm sure there's mention in the
> documentation about how to supress the generation of constraints but i
> don't seem to be able to find it.  can someone point me in the right
> direction?

Looks like you want "is_foreign_key_constraint => 0" in your relationship 
attributes, see DBIx::Class::Relationship::Base.

Jess




More information about the DBIx-Class mailing list