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)

initial-migrations-contrib.diff (21.3 KB ) - added by Andrew Godwin 11 years ago.
First diff of initial migrations for contrib apps. Lots of test errors (but not in migrations)

Download all attachments as: .zip

Change History (20)

comment:1 by Andrew Godwin, 11 years ago

Owner: set to Andrew Godwin
Status: newassigned

comment:2 by Andrew Godwin, 11 years ago

Owner: Andrew Godwin removed
Severity: Release blockerNormal
Status: assignednew
Triage Stage: UnreviewedAccepted

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.

by Andrew Godwin, 11 years ago

First diff of initial migrations for contrib apps. Lots of test errors (but not in migrations)

comment:3 by Claude Paroz, 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.

https://github.com/django/django/pull/2590

comment:4 by Tim Graham, 11 years ago

Triage Stage: AcceptedReady for checkin

comment:5 by Claude Paroz, 11 years ago

Patch needs improvement: set
Triage Stage: Ready for checkinAccepted

Back to accepted:

  • Loïc suggested a workaround to the initial.py vs 0001_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 and MIGRATION_MODULES hack in runtests.py: if we include the MIGRATION_MODULES hack in runtests.py and don't include django.contrib.auth in tested labels, the creation of the test database fails because the flush command fails (auth_customuser table missing).

comment:6 by Claude Paroz, 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:7 by Tim Graham <timograham@…>, 10 years ago

In ec6e2eac60be52f7a5979ebc29a64197f5a11174:

Added database migration for contrib.sites.

refs #22170.

comment:8 by Tim Graham <timograham@…>, 10 years ago

In 7da16b99dfa72beb782467d3644467457e1c6145:

Added database migration for contrib.flatpages.

refs #22170.

comment:9 by Tim Graham <timograham@…>, 10 years ago

In d7576bb27ad2825814ed9909271d3f64cb0e2bc4:

Added database migration for contrib.redirects.

refs #22170.

comment:10 by Tim Graham <timograham@…>, 10 years ago

In 534d9f1e822ef49550c195a4e9493970781c4591:

[1.7.x] Added database migration for contrib.sites.

refs #22170.

Backport of ec6e2eac60 from master

comment:11 by Tim Graham <timograham@…>, 10 years ago

In ec7cddd361c7e575397e067c5f0e0846c11a0b10:

[1.7.x] Added database migration for contrib.flatpages.

refs #22170.

Backport of 7da16b99df from master

comment:12 by Tim Graham <timograham@…>, 10 years ago

In 380cafe5bee50d4cc9d90ef6e33e47be9de25e0b:

[1.7.x] Added database migration for contrib.redirects.

refs #22170.

Backport of d7576bb27a from master

comment:13 by Tim Graham <timograham@…>, 10 years ago

In 37a8f5aeedcfc5b4605960e5dc3d989456ce88b9:

Added database migration for contrib.sessions.

refs #22170.

comment:14 by Tim Graham <timograham@…>, 10 years ago

In a15bf2cd4e8f7279488f04aaf3040f420dc5f9cb:

[1.7.x] Added database migration for contrib.sessions.

refs #22170.

Backport of 37a8f5aeed from master

comment:15 by Tim Graham <timograham@…>, 10 years ago

In eb8600a65673649ea15ed18d17127f741807ac8b:

Added database migration for contrib.contenttypes.

Moved contenttypes tests to allow them to run correctly in the presence of
migrations. refs #22170.

comment:16 by Tim Graham <timograham@…>, 10 years ago

In a0bf14a2accb75987657a9656bccfc8b9df8d375:

[1.7.x] Added database migration for contrib.contenttypes.

Moved contenttypes tests to allow them to run correctly in the presence of
migrations. refs #22170.

Backport of eb8600a656 from master

comment:17 by Tim Graham <timograham@…>, 10 years ago

In b341f33697cdd26cc967c2ca4a0ac679f4167319:

Added database migration for contrib.auth.

refs #22170.

comment:18 by Tim Graham <timograham@…>, 10 years ago

In d36b54d753a1fb79f32f6b7a91d582bccb7ab311:

[1.7.x] Added database migration for contrib.auth.

refs #22170.

Backport of b341f33697 from master

comment:19 by Tim Graham, 10 years ago

Resolution: fixed
Status: newclosed

Initial migrations have now been added for all contrib apps (except deprecated comments).

Note: See TracTickets for help on using tickets.
Back to Top