[Dbix-class] ON DELETE statement in Pg not avaiable in schema::loader?

Moritz Onken onken at houseofdesign.de
Sat Mar 8 17:11:22 GMT 2008


Wouldn't it be great (tm) if we could add an "on_delete" and  
"on_update" config
to all the relationships? Like the "cascade_delete" config option.

If the DMBS supports that type of actions DBIC does not have to take  
care of it,
otherwise it does.

There might be a good reason why this has not been done :-)

Am 08.03.2008 um 17:58 schrieb Matt S Trout:

> On Tue, Feb 26, 2008 at 01:17:37PM +0100, Moritz Onken wrote:
>> Hi,
>>
>> I use the ON DELETE statements in my Pg database to set the foreign
>> key to null if a column is deleted.
>>
>> But this information doesn't make it's way to the schema if I use
>> Schema::Loader. And therefore the files created by create_ddl_dir are
>> useless because they don't contain this information either.
>>
>> I'd like to write a patch but I have no clue where to put this kind  
>> of
>> code!
>
> First, figure out what syntax you'd need in your files to make  
> create_ddl_dir
> work. (frankly, using Schema::Loader -and- create_ddl_dir is silly -  
> pick one
> place to be primary and stick with it).
>
> You may need to check SQL::Translator::Producer::PostgreSQL to  
> figure out
> whether it's supported.
>
> If it isn't, that's the first thing to patch. If not, proceed to  
> stage 2.
>
> Stage 2, write a failing test for DBIx::Class::Schema::Loader and then
> patch that to figure out the ON DELETE info when it loads a pg schema.
>
> -- 
>      Matt S Trout       Need help with your Catalyst or DBIx::Class  
> project?
>   Technical Director                    http://www.shadowcat.co.uk/catalyst/
> Shadowcat Systems Ltd.  Want a managed development or deployment  
> platform?
> http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.rawmode.org




More information about the DBIx-Class mailing list