Support evolving unique_together.

Review Request #5098 — Created Dec. 12, 2013 and submitted — Latest diff uploaded

Information

Django Evolution
master

Reviewers

Support evolving unique_together.

Django-Evolution has always recorded unique_together, but never
supported evolving it. If a project changed this value, it would be
ignored and never applied to the database, yet would be recorded.

This introduces a new ChangeMeta mutation that accepts changing a Meta
property. Currently, only unique_together is supported. The
unique_together property can be set to any value, and Django Evolution
will attempt to drop any old indexes it can find (if any exist) from the
old signature, and set up indexes for the new signature.

Projects should add a ChangeMeta for any models that have a
unique_together, to ensure that the proper value is used and recorded.

  • Unit tests pass for SQLite, MySQL, and Postgres, with Django 1.4 and 1.5.

  • Installed a Review Board 1.6.x site with Django Evolution 0.6.9 using MySQL.
    Then, with RB 2.0 and this patch, I checked evolve --hint. It listed evolutions
    for all the unique_together fields.

  • Added those evolution files and ran evolve --execute. Saw that they applied.

  • Also tested all this with my old database that I've carried over since 1.0 (and
    had newly stored unique_together fields but no actual indexes for them). No
    problems.