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

Matt S Trout dbix-class at trout.me.uk
Sat Mar 8 16:58:40 GMT 2008


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/



More information about the DBIx-Class mailing list