Fix adding record after a successfull migration when sharding.

#102 Declined
  1. Goulwen Reboux

I'm trying to handle migrations of sharded models using south (and django 1.5-rc1)

It works well by default, except when recording the post migration record when the model is not sharded.

Two smalls changes allows this to works as expected, but it may breaks compatibility with django < 1.2

Comments (2)

  1. Goulwen Reboux author

    The whitespaces are just for PEP008 compatibility (at least with Flakes8Lint in SublimeText). It's not very important.

    My patch was about easing handling sharding, not provide something by default (I don't think it's possible as there's as many ways to shard as projects that need it.)

    I agree with the fact that this patch should not change anything but the truth is that it allows south to save the record in the MigrationHistory model in the good database. I suppose that while the migration switches between the databases to alter tables, south lost the default one.

    1. Andrew Godwin repo owner

      Whitespace patches to comply with PEP8 are fine if they're a separate commit, having them in a patch that does something else too just messes up the patch!

      South doesn't "change between the databases" internally as you're suggesting; if you save a model it always saves to the default database. Are you sure this actually changes something? Can you provide a test that fails without the patch and passes with it?