Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#27110 closed Bug (fixed)

makemigrations shouldn't create `django_migrations` table in external databases

Reported by: direx Owned by: Tim Graham
Component: Migrations Version: 1.10
Severity: Release blocker Keywords: regression
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In Django 1.10 the makemigrations command creates a database table django_migrations in all databases defined in settings.DATABASES. In Django 1.9 and earlier this was not the case.

This behavior is bad if no (or only unmanaged) models reside in these databases. In my case I have quite a lot of databases defined in settings.DATABASES to be able to connect to them in a unified way. I only do raw SQL in there, so Django should not mess with these databases (or worse, introduce schema changes in third-party databases, like Django 1.10 does).

This is somewhat related to Bug #27054, although the fix provided there does not solve the issue. This regression is introduced by 02ae5fd31a56ffb42feadb49c1f3870ba0a24869.

Change History (8)

comment:1 by Tim Graham, 8 years ago

Component: UncategorizedMigrations
Owner: changed from nobody to Tim Graham
Severity: NormalRelease blocker
Status: newassigned
Summary: [regression] makemigrations creates `django_migrations` table in external databasesmakemigrations shouldn't create `django_migrations` table in external databases
Triage Stage: UnreviewedAccepted
Type: UncategorizedBug

comment:2 by Tim Graham, 8 years ago

Has patch: set

comment:3 by Tim Graham, 8 years ago

An alternate proposal about consulting database routers is under discussion in #27142. It would be nice to have some confirmation that it solves your use case.

comment:4 by Tim Graham, 8 years ago

There's a new PR which uses the database routers idea.

comment:5 by GitHub <noreply@…>, 8 years ago

Resolution: fixed
Status: assignedclosed

In 098c07a:

Fixed #27142, #27110 -- Made makemigrations consistency checks respect database routers.

Partially reverted refs #27054 except for one of the tests as this
solution supersedes that one.

Thanks Shai Berger for the review.

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

In 3e913d2:

[1.10.x] Fixed #27142, #27110 -- Made makemigrations consistency checks respect database routers.

Partially reverted refs #27054 except for one of the tests as this
solution supersedes that one.

Thanks Shai Berger for the review.

Backport of 098c07a03286b5ed133102733e67a83061647ea0 from master

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

In c93ac9cf:

Refs #25850, #27142, #27110 -- Documented migration history consistency checks.

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

In 57f7d896:

[1.10.x] Refs #25850, #27142, #27110 -- Documented migration history consistency checks.

Backport of c93ac9cf42bff259ab71b70a89b693b9c38e4666 from master

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