Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Moe Khatib
Moe Khatib
5,293 Points

Heroku db:migrate Error

I am still a rails beginner and I am trying to deploy an app to heroku but when trying to run the:

heroku run rake db:migrate

I am getting an error:

PG::DataCorrupted: ERROR:  could not read block 6 in file "base/18350/12684": read only 0 of 8192 bytes
: CREATE TABLE "searches" ("id" serial primary key, "city_id" integer, "num_weeks" integer, "num_seats" integer, "start_date" date, "student_name" character varying(255), "program_id" integer, "user_id" integer, "created_at" timestamp, "updated_at" timestamp) 
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

Here is the migration:

class CreateSearches < ActiveRecord::Migration
  def change
    create_table :searches do |t|
      t.integer :city_id
      t.integer :num_weeks
      t.integer :num_seats
      t.date :start_date
      t.string :student_name
      t.integer :program_id
      t.integer :user_id


I am not quite sure what is going on, any help would be appreciate it.

2 Answers

Stone Preston
Stone Preston
42,016 Points

hmm this post on stack overflow might suggest its a problem with Heroku. several people getting the same error around the same time.

Moe Khatib
Moe Khatib
5,293 Points

Thank you Stone, I will keep an eye on it.

Iyad Horani
Iyad Horani
Courses Plus Student 6,141 Points

I was having the same issue yesterday and contacted heroku support team, the database is working again, bellow is the response

Unfortunately, it looks like there was an issue with your database last night which caused an outage for a couple hours, however it's since been recovered by one of our on-call database engineers. This issue wasn't caused by you at all, it was a hardware failure on the host server.

Hope this helps.