josegonzalez / rad-cakephp-2

Issue Tracker for the "Rapid Application Development with CakePHP 2" BOOK
http://josediazgonzalez.com/cakephp-book/
3 stars 1 forks source link

Migration changes not reflected on Heroku/ClearDB #11

Open sunfffd opened 10 years ago

sunfffd commented 10 years ago

Hi :) 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?

By the way, on page 33, $cd /vagrant/chef this path does not exist, I believe it's /vagrant/app ?

josegonzalez commented 10 years ago

Odd issue with the migrations bit. Is this just following the book or did you do something else?

sunfffd commented 10 years ago

was just trying out the workflow: 1) added a field locally with phpmyadmin 2) cake Migrations.Migration generate (compare Yes and overwrite schema Yes) 3) git push heroku master

changes not reflected

josegonzalez commented 10 years ago

What was the generated schema?

josegonzalez commented 10 years ago

And did you commit the migration to your repo before pushing?

sunfffd commented 10 years ago

Hi Jose i finally managed to partially run the migrations on my heroku dyno, Migrations like creation actions like creating tables and creating fields can be performed successfully.

Then I tried to reset the migrations on the dyno, however the drop statements cannot be performed. It seems they are ignored. (the field that I added in the latest migration was not dropped)

josegonzalez commented 10 years ago

Do you know what the state of the database is after you call the reset? Can you paste the exact commands you are running?

sunfffd commented 10 years ago

After I run the migrations from git push, I use the following command to run the reset directly on heroku $heroku run "app/Console/cake Migrations.migration run reset" there were some conflicts where a field was already existed or missing from the database.

Is there a way to complete remove the migrations and start fresh from my current schema?