On Saturday 09 January 2016 04:56:11 'Hugo Osvaldo Barrera' via Django 
developers (Contributions to Django itself) wrote:
> 
> In my case, once data migrations have run in staging/production, they're
> useless and can be ignored forever, so there's no point in keeping them
> in later squashed migrations months later.
>

There are two kinds of data migrations, generally speaking.

One is the kind that is needed to facilitate some schema migrations. Changing 
the type of some field, for example, usually involves creating the new field 
(schema migration), transforming the data from the old field to the new (data), 
and then removing the old field (and perhaps some renaming; schema). This kind 
of migrations, indeed, can be just removed when squashing.

The other is migrations which *create* data -- fill in tables for database-
implemented-enums, for example. If you remove these, you are going to break 
your tests (if you do this and haven't broken your tests, your tests are 
missing -- I'd go as far as calling them broken).

The second kind is quite common. Having a built-in command that resets 
migrations and ignores them is, IMO, encouragement to skip testing, and I 
think we shouldn't do that. Some notion (as Carl, I think, mentioned) of 
"squashable data migrations" -- essentially, telling the two kinds apart -- 
would be helpful. but not solve the problem completely, because, ultimately, 
the second kind exists. We need to figure out how to help users deal with them.

Shai.
  • ... Tim Graham
    • ... Florian Apolloner
      • ... Peter Baumgartner
        • ... Aymeric Augustin
          • ... Andrew Godwin
          • ... Carl Meyer
            • ... Peter Baumgartner
              • ... Markus Holtermann
            • ... 'Hugo Osvaldo Barrera' via Django developers (Contributions to Django itself)
              • ... Shai Berger
                • ... charettes
                • ... Carl Meyer
                • ... Shai Berger
                • ... RenĂ© Fleschenberg

Reply via email to