[Dbix-class] SQL::Translator::Parser::DBIx::Class unique symbol change

Ash Berlin ash_cpan at firemirror.com
Fri May 16 15:20:45 BST 2008


On 16 May 2008, at 14:56, Matt S Trout wrote:

> On Thu, May 15, 2008 at 10:53:20AM -0700, Ryan D Johnson wrote:
>> The specific problem with the old naming code was that it was
>> unstable. I might have a constraint foo today which tomorrow the sqlt
>> layer decided to name foo_2 (because there's a new constraint it  
>> wants
>> to name foo). This is bad for exactly the same reasons that changing
>> from the old naming code to the new naming code sucks.
>
> The SQLT diffing code needs to compare a hash of the -nature- of the
> constraint instead of the name.
>
> Then constraints can be renamed at will, and the code can go "well,  
> eh,
> the constraint/index is called X here but who cares?". Think of it as
> somewhat similar to diff's ignore whitespace option.
>
> Then you can use unstable naming, stable naming, we can bugfix the  
> naming
> in future (the new one won't be perfect, it never is first time :),  
> and
> who fucking cares.
>
> Fancy having a go? You were right to not try and maintain compat  
> within
> the changes you made but we -do- need to fix forward compatibility  
> for the
> upgrade path.

SQLT::Diff already supports ignoring the names of indexs and  
constraints. This is done by:

   $diff->ignore_constraint_names(1)

and similarlly for ignore_index_names (where $diff is a  
SQL::Translator::Diff object)

The problem comes with how to let this be configurable, since  
personally I quite like the index names being stable/correct (as they  
are now for me) - my production DB is currently tiny so renames aren't  
an issue, but I know for a fact that Luke's DB is huwge....

****

Oh. actually looking at the code, $sqltargs to create_ddl_dir is  
already the options has that SQL::T::Diff reads.

Luke: try passing { ignore_constraint_names => 1} to the last arg for  
create_ddl_dir (to check it works etc., then we can sort out a way  
forward)

-ash
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20080516/3f1235cb/attachment.htm


More information about the DBIx-Class mailing list