Heroku database migration

83 views
Skip to first unread message

Aman Mandloi

unread,
Jul 19, 2020, 12:48:18 PM7/19/20
to Django users
Added a small model 'new_model' in existing app 'existing_app' on Django,
Entered commands manage.py makemigrations and manage.py migrate it migrated changes to local database.
Tried to apply same on heroku but its not working there. I then tried to setup heroku database in local settings.py of project and migrations worked but it shown some well known error, I have attached the output with this discusssion. Attaching the final screenshot as output.

_________________Just In Case if it may help___________________________________________________ 
The following are the methods I have applied before the final solution:- 
1. With heroku run manage.py makemigrations 
2. Adding makemigrations command to procfile 
3. Pushing migrations as well, so it may replace server migrations
The all three mentioned steps provided this output:- "No migrations to apply, and on migrate it shows you dont have new migrations",
helping out to migrate changes on database.  
Thank You.

imgpsh_fullsize_anim.png

Joakim Hove

unread,
Jul 19, 2020, 1:08:31 PM7/19/20
to django...@googlegroups.com
bash% heroku run python. /manage.py migrate

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ee20b599-619d-4b38-949d-fdfb18cf9711o%40googlegroups.com.

Heet Gupta

unread,
Jul 19, 2020, 2:47:53 PM7/19/20
to Django users
Firstly push your code containing the migrations folder to heroku ("git push heroku master"), then follow the below steps -

In your terminal run the command "heroku run bash".
It will open the heroku terminal for you.
Now In the heroku terminal run "python manage.py migrate"

Ayser shuhaib

unread,
Jul 19, 2020, 3:04:46 PM7/19/20
to django...@googlegroups.com
I've experienced this problem many times and the solution is to simply change the name of the model then do the migration and after that you can change the model name to the original name and run the migration again, I think it's a bug in django.

--
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.

Dvs Khamele

unread,
Jul 20, 2020, 11:29:54 AM7/20/20
to django...@googlegroups.com
Hi all I tried every solution here. Thanks.
But got the same error as:- No migrations to apply.
Is there anything else I can try?

imgpsh_fullsize_anim.png

John McClain

unread,
Jul 20, 2020, 12:45:28 PM7/20/20
to django...@googlegroups.com
why not commit to git and run deploy within heroku console as we have always done?

--
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.


--
John McClain

Cell: 085-1977-823
Skype: jmcclain0129

Karan Sahu

unread,
Jul 20, 2020, 1:41:40 PM7/20/20
to django...@googlegroups.com
Tried sending you that ss :)

Reply all
Reply to author
Forward
0 new messages