Opened 11 years ago
Closed 10 years ago
#22170 closed New feature (fixed)
Add initial migrations for contrib apps
Reported by: | Tim Graham | Owned by: | |
---|---|---|---|
Component: | Migrations | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
There was some discussion among the core devs about the possibility of adding migrations for contrib apps in 1.7. I think the consensus was that it would be safer to release 1.7 without any schema changes, but to include the initial migrations for contrib apps to get people thinking about them.
Attachments (1)
Change History (20)
comment:1 by , 11 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:2 by , 11 years ago
Owner: | removed |
---|---|
Severity: | Release blocker → Normal |
Status: | assigned → new |
Triage Stage: | Unreviewed → Accepted |
by , 11 years ago
Attachment: | initial-migrations-contrib.diff added |
---|
First diff of initial migrations for contrib apps. Lots of test errors (but not in migrations)
comment:3 by , 11 years ago
Has patch: | set |
---|
Tests pass, at least with SQLite and PostgreSQL. Main difficulty was to have the auth tests run the migration for various custom user models.
comment:4 by , 11 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:5 by , 11 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Ready for checkin → Accepted |
Back to accepted:
- Loïc suggested a workaround to the
initial.py
vs0001_initial.py
naming issue in auth. - I must have forgotten to include the sessions migration
- A more serious issue I discovered is about the
auth
andMIGRATION_MODULES
hack inruntests.py
: if we include theMIGRATION_MODULES
hack inruntests.py
and don't includedjango.contrib.auth
in tested labels, the creation of the test database fails because theflush
command fails (auth_customuser
table missing).
comment:6 by , 11 years ago
I find the auth
migration really hard to do right, if anyone feels like doing it, please go ahead. I think it could be done independently of other migrations. The difficulty lies in having two sets of migrations (one with custom user for tests and one "normal") and playing nicely with runtests.py
, migrate
and flush
.
comment:19 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Initial migrations have now been added for all contrib apps (except deprecated comments).
I've had a go at this, and it's just too much to do before 1.7, and I don't consider it a release blocker.
The main problem is the test suite; it heavily relies on some intricate behaviours of the way models are created and the ordering of that, and migrations changes just enough that large swathes of it fail. I've attached the patch of my work so far for future reference when we come back to this.