[PATCH] migrations: Squash 0001 to 0040
stephen at that.guru
Sun Apr 26 23:00:32 AEST 2020
On Fri, 2020-04-10 at 12:08 +0100, Stephen Finucane wrote:
> Now that we're moving a new major version, we can squash the migrations
> we have to date. This coexists alongside the old migrations, which we
> can remove and replace entirely when we release 4.0, per the advice of
> the 'squashmigrations' tool.
> You should commit this migration but leave the old ones in place; the
> new migration will be used for new installs. Once you are sure all
> instances of the codebase have applied the migrations you squashed,
> you can delete them.
> The 'squashmigrations' tool can't parse the output of 'RunPython' blocks
> so the output of the tool was less optimized than it could be. As a
> result, we've manually modified this change to remove the 'RunPython'
> block and unnecessary 'AlterField' entries. This was done by removing
> all migration and generating a new "initial" migration, which was then
> modified to mark all strings as byte strings (as they were when we were
> using Python 2 to generate these migrations) so that 0041 would apply
> The main benefit of this change is that it significantly reduces the
> startup time for unit tests. Executed on my host, the run time for a
> single test goes from ~ 22 seconds to ~ 14 seconds. This is obviously
> reduced for additional tests.
> Signed-off-by: Stephen Finucane <stephen at that.guru>
> Cc: Daniel Axtens <dja at axtens.net>
Given the results of the below testing, I'm pretty happy with this so
I've gone ahead and applied it.
> NOTE: I tested this by removing every other migration and attempting to
> recreate the one migration that's not in this squash - 0041. It resulted
> in the exact same migration, albeit with the number 0002, so this looks
More information about the Patchwork