Happened again on the other app. This has happened to me on two apps., twice each in the last 2 days.

Here's the first part of the script that I run to deploy to Heroku:

$ cat push
#!/bin/sh

git push koached-bot master
git push heroku master
heroku rake db:migrate
heroku restart

Below is the output - see how the "CREATE TABLE tropo_sessions...." fails because the table is already there?

$ push
Counting objects: 7, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 438 bytes, done.
Total 4 (delta 3), reused 0 (delta 0)
To g...@koached.unfuddle.com:koached/koached-bot.git
   05853ef..ad5845d  master -> master
Counting objects: 7, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 438 bytes, done.
Total 4 (delta 3), reused 0 (delta 0)

-----> Heroku receiving push
-----> Rails app detected
-----> Gemfile detected, running Bundler version 1.0.3
       Unresolved dependencies detected; Installing...
       Using --without development:test
       Fetching source index for http://rubygems.org/
       Installing rake (0.8.7)
       Installing activesupport (2.3.10)
       Installing rack (1.1.0)
       Installing actionpack (2.3.10)
       Installing actionmailer (2.3.10)
       Installing activerecord (2.3.10)
       Installing activeresource (2.3.10)
       Installing builder (3.0.0)
       Installing dalli (1.0.1)
       Installing haml (3.0.25)
       Installing hashie (0.4.0)
       Installing hoptoad_notifier (2.4.2)
       Installing json_pure (1.5.1)
       Installing mime-types (1.16)
       Installing rails (2.3.10)
       Installing rest-client (1.6.1)
       Installing tropo-webapi-ruby (0.1.9)
       Installing twiliolib (2.0.7)
       Using bundler (1.0.3)
       Your bundle is complete! It was installed into ./.bundle/gems/
-----> Installing quick_sendgrid plugin from git://github.com/pedro/quick_sendgrid.git... done.
-----> Configuring New Relic plugin... done.
       Installing the New Relic plugin... done.
       Compiled slug size is 4.4MB
-----> Launching... done
-----> Running email deploy notification... done
-----> Running New Relic deploy notification... done

       http://koached-bot.heroku.com deployed to Heroku

To g...@heroku.com:koached-bot.git
   05853ef..ad5845d  master -> master
rake aborted!
An error has occurred, this and all later migrations canceled:

PGError: ERROR:  relation "tropo_sessions" already exists
: CREATE TABLE "tropo_sessions" ("id" serial primary key, "session_id" character varying(255), "network" character varying(255), "username" character varying(255), "created_at" timestamp, "updated_at" timestamp)

(See full trace by running task with --trace)
(in /disk1/home/slugs/53b68510-1a14-4a6e-b8c4-5625960805ca/mnt)
== CreateTropoSessions: migrating ============================================
-- create_table(:tropo_sessions)
App processes restarted

============== END OUTPUT ===========

After this happened, I restored to the previous backup of the DB (which is the state of the DB before I ran the update). Here is the schema_migrations table:

>> TropoSession.connection.execute("SELECT * FROM schema_migrations").each {|r| puts r.inspect}
{"version"=>"20110118214243"}
{"version"=>"20110121191631"}
{"version"=>"20110121204849"}
{"version"=>"20110124183710"}
=> #<PGresult:0x2b2bb6482f30>

Here are the contents of my db/migrate directory:

$ ls -l db/migrate
total 32
-rw-r--r--@ 1 weyus staff 273 Jan 18 15:44 20110118214243_create_tropo_sessions.rb -rw-r--r--@ 1 weyus staff 364 Jan 21 13:24 20110121191631_create_tropo_questions.rb -rw-r--r--@ 1 weyus staff 193 Jan 21 14:49 20110121204849_add_type_to_tropo_questions.rb -rw-r--r--@ 1 weyus staff 288 Jan 24 12:37 20110124183710_create_tropo_answers.rb

What is going on here? It behaves like the schema_migrations table isn't there or is somehow not accessible.

Wes

On 1/25/11 11:07 PM, Wes Gamble wrote:
This happened again to me.  I verified that:

- the schema_migrations table was full of data
- that a Gemfile change didn't prompt this.

For whatever it's worth, here is the relevant portion of my Ruby script for pushing my app to heroku:

#Push to Heroku
system 'git push heroku'

#Migrate the DB for the main application
system 'heroku rake db:migrate'

I have the DB backups in place to recover from this, but it is very disconcerting.

I'm trying to think of a reason why the schema_migrations table might not be available after the 'git push heroku' call. Should I make the script sleep for a couple of seconds?

Wes

On 1/25/11 6:27 PM, Wes Gamble wrote:
Today, I ran my standard task to push changes to two different Heroku apps.

As part of this task, I issue a:

    heroku rake db:migrate

In both cases, the database started migrating from the very first migration. This, of course, doesn't make sense unless the schema_migrations table were empty or something, which shouldn't have been the case.

Has anyone else complained about this today?

After restoring the DBs in question up from my local installation using taps, I didn't see this behavior again.

Wes
--
You received this message because you are subscribed to the Google Groups "Heroku" group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to heroku+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/heroku?hl=en.
--
You received this message because you are subscribed to the Google Groups "Heroku" group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to heroku+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/heroku?hl=en.

--
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.

Reply via email to