<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On 16 May 2008, at 14:56, Matt S Trout wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">On Thu, May 15, 2008 at 10:53:20AM -0700, Ryan D Johnson wrote:<br><blockquote type="cite">The specific problem with the old naming code was that it was<br></blockquote><blockquote type="cite">unstable. I might have a constraint foo today which tomorrow the sqlt<br></blockquote><blockquote type="cite">layer decided to name foo_2 (because there's a new constraint it wants<br></blockquote><blockquote type="cite">to name foo). This is bad for exactly the same reasons that changing<br></blockquote><blockquote type="cite">from the old naming code to the new naming code sucks.<br></blockquote><br>The SQLT diffing code needs to compare a hash of the -nature- of the<br>constraint instead of the name.<br><br>Then constraints can be renamed at will, and the code can go "well, eh,<br>the constraint/index is called X here but who cares?". Think of it as<br>somewhat similar to diff's ignore whitespace option.<br><br>Then you can use unstable naming, stable naming, we can bugfix the naming<br>in future (the new one won't be perfect, it never is first time :), and<br>who fucking cares.<br><br>Fancy having a go? You were right to not try and maintain compat within<br>the changes you made but we -do- need to fix forward compatibility for the<br>upgrade path.<br></blockquote><br></div><div><div>SQLT::Diff already supports ignoring the names of indexs and constraints. This is done by:</div><div><br></div><div>&nbsp;&nbsp;$diff-><font class="Apple-style-span" color="#000000" size="3"><span class="Apple-style-span" style="background-color: transparent; font-size: 12px; ">ignore_constraint_names(1)</span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px; "><br></span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px; ">and similarlly for ignore_index_names (where $diff is a SQL::Translator::Diff object)</span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px; "><br></span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px; ">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....</span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px; "><br></span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;">****</span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px; ">Oh. actually looking at the code, $sqltargs to create_ddl_dir is already the options has that SQL::T::Diff reads.</span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px; "><br></span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px; ">Luke: try passing {&nbsp;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)</span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px; "><br></span></font></div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px; ">-ash</span></font></div></div></body></html>