[Django] #21889: Record hash of applied migrations

4 views
Skip to first unread message

Django

unread,
Jan 28, 2014, 10:00:31 AM1/28/14
to django-...@googlegroups.com
#21889: Record hash of applied migrations
-----------------------------+--------------------
Reporter: thomasf@… | Owner:
Type: New feature | Status: new
Component: Migrations | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------
Simple list spec:
* After an migration has been applied its hash is stored in the migration
table
* The hash value could probably just be a file hash of the migration
python source file
* Before new migrations are applied all previous migrations should be
checked to not only have the correct id but also the same content.
* Migration modification without triggering any hash errors (like
documentation only updates) can be supported using a hash property on the
migration model that allows the developer to let the migration keep its
previous hash.
* An --force-update-migration-hash option can be added the migration
command for an explicit "i don't care' situation.

I've seen this other database migration frameworks and it has been a very
useful thing to have at times.

--
Ticket URL: <https://code.djangoproject.com/ticket/21889>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 9, 2014, 7:05:27 AM2/9/14
to django-...@googlegroups.com
#21889: Record hash of applied migrations
-----------------------------+--------------------------------------
Reporter: thomasf@… | Owner:
Type: New feature | Status: closed
Component: Migrations | Version: master
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------
Changes (by andrewgodwin):

* status: new => closed
* needs_better_patch: => 0
* resolution: => wontfix
* needs_tests: => 0
* needs_docs: => 0


Comment:

I'm going to make a call on this as WONTFIX - while it's a nice idea, in
practice I've seen good reasons to edit old migration files (adding
comments, re-whitespacing) and things like git might automatically change
the hash of all the files if their line ending mode is changed.

In particular, it adds a non-obvious failure mode for people who won't be
immediately familiar with what's going on, especially if they just popped
back in to add some comments or something, and the only thing Django can
do is be very user-unfriendly and moan; what would we propose the user do?
Roll back everything and re-apply it?

I can see some merit in perhaps doing some sort of hash off of the
Operations themselves, thus hashing only the semantic meaning of the
migration, but that would be a relatively large change and not something
I'm prepared to introduce in 1.7, especially as it puts even more onus on
people already having to adapt to this big change. Perhaps we can revisit
it for a later release, but since I'm not going to mark it as accepted I
can't leave it languishing in "new", so I feel closing is cleanest for
now.

--
Ticket URL: <https://code.djangoproject.com/ticket/21889#comment:1>

Django

unread,
Feb 9, 2014, 6:14:17 PM2/9/14
to django-...@googlegroups.com
#21889: Record hash of applied migrations
-----------------------------+--------------------------------------
Reporter: thomasf@… | Owner:
Type: New feature | Status: closed
Component: Migrations | Version: master
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------

Comment (by anonymous):

Good call on closing the issue.
Thanks for replying.

--
Ticket URL: <https://code.djangoproject.com/ticket/21889#comment:2>

Reply all
Reply to author
Forward
0 new messages