Opened 7 years ago

Closed 7 years ago

Last modified 7 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 Changed 7 years ago by Tim Graham

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 Changed 7 years ago by Tim Graham

Has patch: set

comment:3 Changed 7 years ago by Tim Graham

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 Changed 7 years ago by Tim Graham

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

comment:5 Changed 7 years ago by GitHub <noreply@…>

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

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

In c93ac9cf:

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

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

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