Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CakePHP Migration changes not reflected on Heroku/ClearDB #163

Open
sunfffd opened this issue Oct 7, 2014 · 2 comments
Open

CakePHP Migration changes not reflected on Heroku/ClearDB #163

sunfffd opened this issue Oct 7, 2014 · 2 comments

Comments

@sunfffd
Copy link

sunfffd commented Oct 7, 2014

Hi :)
Using Cake Migration plugin, I generate the migration and schema with cake console and tested adding a field into a table using phpmyadmin locally, which then the migration file shows the create_field changes in it.

I also added the heroku compile directive

{
    "extra": {
        "heroku": {
            "framework": "cakephp2",
            "document-root": "webroot",
            "index-document": "index.php",
            "compile" : [
                        "app/Console/cake Migrations.migration run all"
                ]
        }
    }
}

When I deploy, all things went smoothly without error, the migrations are said to be completed too.

 Running migrations:
         [1411665836] 1411665836_poll

         [1411665910] 1411665910_poll

         [1411666078] 1411666078_poll

         [1411666112] 1411666112_poll

         [1411666213] 1411666213_poll

         [1411666272] 1411666272_poll

       ---------------------------------------------------------------
       All migrations have completed.

However when I check the production database, the new field was not created. Is there any way to verify if the operation was really successful?

@stof
Copy link
Collaborator

stof commented Oct 7, 2014

I have no experience with CakePHP, but be careful that the slug compilation does not run on your live dynos. environment variables might be different. It could create some issues.

If you perform the same migration run locally on a test database, does it create the field you expect ?

@sunfffd
Copy link
Author

sunfffd commented Oct 7, 2014

Hi stof, thanks for your suggestions.

Did some quick tests again, I was able to have the fields created when I deploy to Heroku. The problem is caused by the schema migration table which stores the migration version being not consistent to the one in my local environment.

However not on dropping fields. :/
It seems that the dropping procedures are ignored

I tried to reset all migrations and added a few iterations of create and dropping fields in the migrations, seems only the create tables and create fields ones are executed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants