Reputation: 1370
My project hosted on heroku and recently i want to change the size of one column in db but after running makemigrations command and then migrate command it gives an error and i don't want to lose my data .
H:\shuboy2014>heroku run python manage.py makemigrations posts
Running python manage.py makemigrations posts on shuboy2014... up, run.9067
Migrations for 'posts':
0003_auto_20160608_1404.py:
- Alter field slug on post
H:\shuboy2014>heroku run python manage.py migrate
Running python manage.py migrate on shuboy2014... up, run.3731
Operations to perform:
Apply all migrations: admin, contenttypes, posts, sessions, auth
Running migrations:
No migrations to apply.
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.
Any helpful suggestions will be appreciable .
Upvotes: 1
Views: 574
Reputation: 56
heroku run
commands run on One-Off Dynos with an ephemeral file system, so you are generating the migrations files on a file system that is immediately destroyed.
You should generate migrations locally, committing and pushing them, and then executing the heroku run python manage.py migrate
command.
Upvotes: 3
Reputation: 1370
I just run makemigrations and migrate command on my local computer and then push it on heroku and run both commands again and its done .
H:\shuboy2014>heroku run python manage.py migrate
Running python manage.py migrate on shuboy2014... up, run.6192
Operations to perform:
Apply all migrations: contenttypes, auth, posts, sessions, admin
Running migrations:
Rendering model states... DONE
Applying posts.0003_auto_20160608_2001... OK
Upvotes: 1