Skip to content

More-correct data migrations - #10590

Merged
nedbat merged 1 commit into
django-upgrade/1.8from
ned/dj18-fixed-data-migrations
Nov 11, 2015
Merged

More-correct data migrations#10590
nedbat merged 1 commit into
django-upgrade/1.8from
ned/dj18-fixed-data-migrations

Conversation

@nedbat

@nedbat nedbat commented Nov 11, 2015

Copy link
Copy Markdown
Contributor

We need to be sure the migrations will work even in the presence of data
from the future. get_or_create is a problem, because if the data
already exists, there could be more than one record, even if this
migration only creates one.

@nedbat

nedbat commented Nov 11, 2015

Copy link
Copy Markdown
Contributor Author

@muhammad-ammar @muzaffaryousaf @symbolist I'm sick to death of data migrations.... :) Help me make this the last change!

@symbolist

Copy link
Copy Markdown
Contributor

👍

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why get_or_create after the check ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point!

We need to be sure the migrations will work even in the presence of data
from the future.  get_or_create is a problem, because if the data
already exists, there could be more than one record, even if this
migration only creates one.
@nedbat
nedbat force-pushed the ned/dj18-fixed-data-migrations branch from bffd5b7 to e7fcc74 Compare November 11, 2015 14:03
@muzaffaryousaf

Copy link
Copy Markdown

👍

nedbat added a commit that referenced this pull request Nov 11, 2015
@nedbat
nedbat merged commit bcf789b into django-upgrade/1.8 Nov 11, 2015
@nedbat
nedbat deleted the ned/dj18-fixed-data-migrations branch November 11, 2015 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants