Friday, June 12, 2015

Re: Squashed migration

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCAAGBQJVev30AAoJEC0ft5FqUuEhlH4P/31cyHIiabLbupoUy9Ke8X4y
tcOp0dXkoQx0URY/4jmb3rg+NMN+g0yFJK3arA3EXzXIM1DXcDA2DgnCQKly7A+f
KxDNuwwjbNGo3Prk9H05qy28NRazDw1FC3h6J0h5YDDaWyjylni3zEaNIRIM8vBE
5ViZuDfFOenjThzaYLAcLGUk4wpyXHvJIVh0eRMdSs7RciQumdmdEHhz8b4a4lJl
+XlvF5MLOU5sBkDMsFvO8j6W61SpikZYVNRUSm6JwpeMFZUjPEOlHJE63Jc7qq07
9zziF5HObJlbFCv2/KvDTQVTAUZ2pL3E1m3DICwDRkScGkPnVIpt1LaKo21TDs26
6HgXP5I0Bn9XG3IB+KbmZQif0fwRQVmi4lEhhpn0oVmHq2H5SSCvPVuP/ATgCI7z
7YrBDnz8zmYD8HbwTwbcf0qVjaOYS64bKmHnZfqhO4Jo4qGjByPG9xoD07J9ojuW
RkpXRiFjnAGzR4+A/fn3UCaUfslLfCihCS96styoP8g/eRVzH6cTMw0um8tM2lfC
olFTwsn0yYiNjJ24IZ99TD6sLVhZZSXcwYDn9OcBQaJeHRT2/2HkeB9sZCnS2tK/
RVh7IJfNZabaDDAEKDTHMppDyokKlgHyBH954xBDNS+Fcygciq+EMJdFXZYjyzIC
Kb+inOVeDcca7AC+dpVq
=AdUv
-----END PGP SIGNATURE-----
On 06/12/2015 06:32 AM, aRkadeFR wrote:
> You need to delete your old migrations so it uses only the squashed
> one after.

No, the squashed migration should be used in place of the old ones for
any new database, even if the old ones are still present. This is the
point of the squashmigrations feature; that you can keep the old ones
around (which is necessary for any deployments that may not yet have
applied all of them) while still gaining the benefit of the new squashed
migration for new deployments (and tests).

I know this works, because I just did it recently myself. It sounds like
Cherie was able to get it working too, though we didn't get any
clarification on why it didn't seem to work originally.

> In the documentation:
> "This enables you to squash and not mess up systems currently in
> production that aren't fully up-to-date yet. The recommended process is
> to squash, keeping the old files, commit and release, wait until all
> systems are upgraded with the new release (or if you're a third-party
> project, just ensure your users upgrade releases in order without
> skipping any), and then remove the old files, commit and do a second
> release."

That's right. The length of time you need to wait before removing can
vary widely. For a third-party app, it may be a full release cycle or
two (as long as you can tell your users to upgrade version-by-version).
For a project with only a few deployments, all under your control, it
may be the same day. But regardless, the squashed migration will still
be used in tests immediately, before you remove the old migrations.

Carl

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/557AFDF3.1090900%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment