#22170 closed New feature (fixed)

Add initial migrations for contrib apps

Reported by: timo Owned by:
Component: Migrations Version: master
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 andrewgodwin 18 months 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 Changed 18 months ago by andrewgodwin

  • Owner set to andrewgodwin
  • Status changed from new to assigned

comment:2 Changed 18 months ago by andrewgodwin

  • Owner andrewgodwin deleted
  • Severity changed from Release blocker to Normal
  • Status changed from assigned to new
  • Triage Stage changed from Unreviewed to Accepted

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.

Changed 18 months ago by andrewgodwin

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

comment:3 Changed 17 months ago by claudep

  • 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 Changed 16 months ago by timo

  • Triage Stage changed from Accepted to Ready for checkin

comment:5 Changed 16 months ago by claudep

  • Patch needs improvement set
  • Triage Stage changed from Ready for checkin to Accepted

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 Changed 16 months ago by claudep

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 Changed 15 months ago by Tim Graham <timograham@…>

In ec6e2eac60be52f7a5979ebc29a64197f5a11174:

Added database migration for contrib.sites.

refs #22170.

comment:8 Changed 15 months ago by Tim Graham <timograham@…>

In 7da16b99dfa72beb782467d3644467457e1c6145:

Added database migration for contrib.flatpages.

refs #22170.

comment:9 Changed 15 months ago by Tim Graham <timograham@…>

In d7576bb27ad2825814ed9909271d3f64cb0e2bc4:

Added database migration for contrib.redirects.

refs #22170.

comment:10 Changed 15 months ago by Tim Graham <timograham@…>

In 534d9f1e822ef49550c195a4e9493970781c4591:

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

refs #22170.

Backport of ec6e2eac60 from master

comment:11 Changed 15 months ago by Tim Graham <timograham@…>

In ec7cddd361c7e575397e067c5f0e0846c11a0b10:

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

refs #22170.

Backport of 7da16b99df from master

comment:12 Changed 15 months ago by Tim Graham <timograham@…>

In 380cafe5bee50d4cc9d90ef6e33e47be9de25e0b:

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

refs #22170.

Backport of d7576bb27a from master

comment:13 Changed 15 months ago by Tim Graham <timograham@…>

In 37a8f5aeedcfc5b4605960e5dc3d989456ce88b9:

Added database migration for contrib.sessions.

refs #22170.

comment:14 Changed 15 months ago by Tim Graham <timograham@…>

In a15bf2cd4e8f7279488f04aaf3040f420dc5f9cb:

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

refs #22170.

Backport of 37a8f5aeed from master

comment:15 Changed 15 months ago by Tim Graham <timograham@…>

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 Changed 15 months ago by Tim Graham <timograham@…>

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 Changed 15 months ago by Tim Graham <timograham@…>

In b341f33697cdd26cc967c2ca4a0ac679f4167319:

Added database migration for contrib.auth.

refs #22170.

comment:18 Changed 15 months ago by Tim Graham <timograham@…>

In d36b54d753a1fb79f32f6b7a91d582bccb7ab311:

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

refs #22170.

Backport of b341f33697 from master

comment:19 Changed 15 months ago by timo

  • Resolution set to fixed
  • Status changed from new to closed

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

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