#22863 closed Cleanup/optimization (fixed)
Document that changing model options unrelated to the database will create migrations
Reported by: | davidray | Owned by: | nobody |
---|---|---|---|
Component: | Migrations | Version: | 1.7-beta-2 |
Severity: | Release blocker | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Django 1.7b4 tag
Steps to reproduce:
- Create initial migrations for app
- drop and recreate database
- Run
python manage.py migrate
- Update a model field's
verbose_name
- Run
python manage.py migrate
Output is as follows:
Running migrations: No migrations needed. Your models have changes that are not yet reflected in a migration, and so won't be applied. Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
- Run
python manage.py makemigrations
Generates an AlterField
migration:
# encoding: utf8 from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('myapp', '0001_initial'), ] operations = [ migrations.AlterField( model_name='mymodel', name='myfield', field=models.ForeignKey(verbose_name='my verbose name', to_field='id', to='myapp.MyModel'), ), ]
I did not think that a modification to verbose_name
would necessitate a migration.
Change History (6)
comment:1 by , 11 years ago
Component: | Migrations → Documentation |
---|---|
Summary: | Adding/Editing Model field verbose_name triggers a need for a migration → Document that changing model options unrelated to the database will create migrations |
Triage Stage: | Unreviewed → Accepted |
Type: | Bug → Cleanup/optimization |
comment:2 by , 11 years ago
Is this really purely a documentation issue? The management command outputs antithetical feedback in this case:
No migrations needed.
followed by:
Your models have changes that are not yet reflected in a migration, and so won't be applied. Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
comment:3 by , 11 years ago
Component: | Documentation → Migrations |
---|---|
Severity: | Normal → Release blocker |
Sorry, I didn't read closely enough, that does seem odd.
comment:4 by , 11 years ago
That output is the same no matter what options you change - it means:
- No migrations are available to run
- You've got changes, so you need to run makemigrations
We added this as a hint to people who were just running migrate and getting confused. I'll update the message to be less confusing and add a docs paragraph about makemigrations and non-database-affecting parameters.
comment:5 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
This is by design, see #22837. As it's becoming a FAQ, we should improve the documentation.