Unapplied Migration - how to apply

534 views
Skip to first unread message

Tim Johnson

unread,
Nov 20, 2018, 11:40:37 AM11/20/18
to Django ML
using django on ubuntu 16.04
python 3.5.2
django.VERSION =
(2, 0, 0, 'final', 0)
Working from the Django Core book by Nigel George.
When launching

(djenv) tim@linus:~/prj/cgi/djenv/djtest$ ./manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).

# the following is a matter of concern:

You have 1 unapplied migration(s). Your project may not work
properly until you apply the migrations for app(s): admin.
Run 'python manage.py migrate' to apply them.

November 19, 2018 - 23:05:05
Django version 2.1.3, using settings 'djtest.settings'
Starting development server at http://127.0.0.1:8000/

# Listing migrations shows:

(djenv) tim@linus:~/prj/cgi/djenv/djtest$ python manage.py showmigrations --list
admin
[X] 0001_initial
[X] 0002_logentry_remove_auto_add
[ ] 0003_logentry_add_action_flag_choices
auth
[X] 0001_initial
[X] 0002_alter_permission_name_max_length
[X] 0003_alter_user_email_max_length
[X] 0004_alter_user_username_opts
[X] 0005_alter_user_last_login_null
[X] 0006_require_contenttypes_0002
[X] 0007_alter_validators_add_error_messages
[X] 0008_alter_user_username_max_length
[X] 0009_alter_user_last_name_max_length
contenttypes
[X] 0001_initial
[X] 0002_remove_content_type_name
sessions
[X] 0001_initial

# It appears that 0003_logentry_add_action_flag_choices
# is not applied

Questions:
1) How do I apply this feature?
2) Where is further relevant discussions or documentation on this
issue? (I've so far not found anything to clarify)
3) How do the migrations above correspond to DB tables (I'm using
the default sqlite3 configuration)?

Thanks
--
Tim Johnson
http://www.tj49.com

Shubham Rewale

unread,
Nov 20, 2018, 12:43:09 PM11/20/18
to Django ML
python manage.py migrate
Then use 
Python manage.py makemigrations

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20181120164001.GI30127%40mail.akwebsoft.com.
For more options, visit https://groups.google.com/d/optout.

Tim Johnson

unread,
Nov 20, 2018, 2:17:39 PM11/20/18
to Django ML
* Shubham Rewale <rewa...@gmail.com> [181120 08:44]:
> python manage.py migrate
> Then use
> Python manage.py makemigrations

Thank you. That worked to apply the missing item.
Note: Had tried that in the past but reversed the sequence of the
two commands.

Have a great day Shubham

> On Tue, 20 Nov 2018, 10:10 p.m. Tim Johnson <t...@akwebsoft.com wrote:
>
> > using django on ubuntu 16.04
> > python 3.5.2
> > django.VERSION =
> > (2, 0, 0, 'final', 0)
> > Working from the Django Core book by Nigel George.
> > When launching
<...> For more options, visit https://groups.google.com/d/optout.

Pekka Malila

unread,
Nov 20, 2018, 2:20:17 PM11/20/18
to django...@googlegroups.com
hi admin

you hope you doing well

thanks for contacting me

i really was a wonderfull day on your office

i hope we can talk together again

vanessa

Joel Mathew

unread,
Nov 20, 2018, 2:24:53 PM11/20/18
to django...@googlegroups.com
makemigrations should come before migrate. You cant migrate without creating the migrations first.
Sincerely yours,

 Joel G Mathew



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

Tim Johnson

unread,
Nov 20, 2018, 3:14:07 PM11/20/18
to django...@googlegroups.com
* Joel Mathew <jo...@joel.su> [181120 10:35]:
> makemigrations should come before migrate. You cant migrate without
> creating the migrations first.
Now I am being confused:

The sequence that Joel suggests did not work for me.
(I tried it before opening this thread)

The reverse sequence that was suggested by Shubham Rewale
did fully apply the migration.

Which is correct?

Joel Mathew

unread,
Nov 20, 2018, 3:16:20 PM11/20/18
to django...@googlegroups.com
Yes, for your special case where you seem to have a pre-existing migration, you dont need makemigrations before migrate. I was just commenting that this is not the usual case.
 
Sincerely yours,

 Joel G Mathew


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

Joel Mathew

unread,
Nov 20, 2018, 3:17:31 PM11/20/18
to django...@googlegroups.com
Anyway, there is no point running `makemigrations` after `migrate` is run. That doesnt do anything, unless you have made a change in your models after your migrate is done

Sincerely yours,

 Joel G Mathew


Tim Johnson

unread,
Nov 20, 2018, 4:08:45 PM11/20/18
to django...@googlegroups.com
* Joel Mathew <jo...@joel.su> [181120 11:18]:
> Yes, for your special case where you seem to have a pre-existing migration,
> you dont need makemigrations before migrate. I was just commenting that
> this is not the usual case.
Thank you.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAA%3Diw_-_35s-zzkB77YUHttjuUU4mMjvkC7r3HDAfyCOFg_g2A%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages