erkan demir
erkan demir

Reputation: 1416

Cannot migrate pending migrations

I deploy my django project to heroku and i m trying to migrate my pending migrations but something going wrong while run migrate command. First i make migrations and than i start migrate but it says

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

  (postjust)erkans-MacBook-Air:postjust erkan$ heroku run python  manage.py makemigrations
        /Users/erkan/.rvm/gems/ruby-2.1.1/gems/heroku-3.7.5/lib/heroku/helpers.rb:93: warning: Insecure world writable dir /Users/erkan/Dev`enter code here`/Python in PATH, mode 040777
        Running `python manage.py makemigrations` attached to terminal... up, run.8854
        Migrations for 'pages':
          0002_auto_20150405_2137.py:
            - Alter field content on page
            - Alter field date on page
        Migrations for 'blog':
          0006_auto_20150405_2137.py:
            - Remove field categories from page
            - Delete model Page
            - Alter field date on blogcategory
            - Alter field date on blogpost


    (postjust)erkans-MacBook-Air:postjust erkan$ heroku run python  manage.py migrate
    /Users/erkan/.rvm/gems/ruby-2.1.1/gems/heroku-3.7.5/lib/heroku/helpers.rb:93: warning: Insecure world writable dir /Users/erkan/Dev/Python in PATH, mode 040777
    Running `python manage.py migrate` attached to terminal... up, run.9864
    Operations to perform:
      Synchronize unmigrated apps: django_extensions, tinymce
      Apply all migrations: sessions, contenttypes, pages, admin, auth, blog
    Synchronizing apps without migrations:
      Creating tables...
      Installing custom SQL...
      Installing indexes...
    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.

I cannt find the problem.

Upvotes: 0

Views: 414

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 599470

You shouldn't be running makemigrations remotely. heroku run spins up a new dyno for each command, so the migrations you created are immediately lost.

Run the makemigrations command locally, commit them to git, then push to heroku and they will be run automatically.

Upvotes: 2

Related Questions