Search code examples
pythondjangomodelmigrationfixture

Will data be displayed after a new migration?


I am using django and have a migration that includes fixture to have some initial data loaded into the web app. I additionally have other data that has been added by users, that isn't included in the fixture.

My question is this: if I create and apply a new migration to bring in new functionality into my app, will the data that has been user-generated still be displayed (I know the data in the fixture will be)?


Solution

  • dumpdata would typically produce the json as:

    [{"pk": 1, "model": "app_name.model", "fields": {"field1": "value1", "field2": "value2", }}, {"pk": 2, "model": "app_name.model", "fields": {"fiel1": "value2", "field2": "value2",  }}]
    

    This means that it would overwrite pk1, pk2 if it exists for the model.

    So, user content would be overwritten if the key is conflicting.