alphagov/whitehall — pull request #972 by elliotcm (2013-10-18 15:13:21+00:00)
Title: Fix attachment ordering part 3

https://www.pivotaltracker.com/story/show/58806434

```
For each document,
unless we know it was manually ordered,
for each edition within that document,
if it was created before the polymorphic deploy,
or it's the first edition since that deploy,
set the attachment ordering to the same as the attachment's ID since it requires 2 editions past the deploy to alter the order of the IDs,
otherwise,
use the ID order of the last known good edition as per the previous rule.
```

In addition to the normal sanity checks, this PR needs input on the following before it's ready to be merged:

This standalone fixer has a unit test which does not need to be run as part of the main test suite but which is probably worth keeping around at least for a little while.

For the sake of expediency, the test suite also relies on the presence of a table (and its contents) in the developers development DB which doesn't even exist in the schema. Clearly not suitable for the normal test flow.

What should we do about keeping the test around without having it run during the test suite?

PS Since this isn't long-lived code I'm not too worried about the code being messy so long as it's correct.