Migration error Heroku pg "PG: DataCorrupted: Error"

When trying to start heroku run rake db:migrate , the following error appears. I tried heroku pg:reset , I tried heroku restart . I also tried to create a new application and start with it, but the problem persists. What could be the problem here?

 Running `rake db:migrate` attached to terminal... up, run.7662 Migrating to CreateChannels (20140424224543) == CreateChannels: migrating ================================================= -- create_table(:channels) PG::DataCorrupted: ERROR: could not read block 0 in file "base/57396/12684": read only 0 of 8192 bytes : CREATE TABLE "channels" ("id" serial primary key, "name" character varying(255), "user_id" integer, "created_at" timestamp, "updated_at" timestamp) rake aborted! StandardError: An error has occurred, this and all later migrations canceled: PG::DataCorrupted: ERROR: could not read block 0 in file "base/57396/12684": read only 0 of 8192 bytes : CREATE TABLE "channels" ("id" serial primary key, "name" character varying(255), "user_id" integer, "created_at" timestamp, "updated_at" timestamp) /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in `async_exec' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in `block in execute' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:435:in `block in log' /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/notifications/instrumenter.rb:20:in `instrument' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:430:in `log' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:127:in `execute' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:190:in `create_table' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:625:in `block in method_missing' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:597:in `block in say_with_time' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:597:in `say_with_time' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:617:in `method_missing' /app/db/migrate/20140424224543_create_channels.rb:3:in `change' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:571:in `exec_migration' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:555:in `block (2 levels) in migrate' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:554:in `block in migrate' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:553:in `migrate' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:709:in `migrate' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:959:in `block in execute_migration_in_transaction' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:1005:in `block in ddl_transaction' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `block in transaction' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:210:in `within_new_transaction' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `transaction' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/transactions.rb:209:in `transaction' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:1005:in `ddl_transaction' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:958:in `execute_migration_in_transaction' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:920:in `block in migrate' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:916:in `each' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:916:in `migrate' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:764:in `up' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:742:in `migrate' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/railties/databases.rake:42:in `block (2 levels) in <top (required)>' Tasks: TOP => db:migrate (See full trace by running task with --trace) 

[Edit] My migration file for creating the channel table is as follows (nothing unusual)

  class CreateChannels < ActiveRecord::Migration def change create_table :channels do |t| t.string :name t.integer :user_id t.timestamps end end end 
+6
source share
3 answers

I had the same problem, I deleted the database from https://dashboard.heroku.com/apps (it was the Navy) A new PG database was added (this is blue)

 From the terminal ran: heroku config You should see your db url heroku config:set DATABASE_URL=postgres://your-db-url Ran heroku run rake db:migrate 

And it worked. I still don’t know why this happened!

+3
source

Last night I contacted the hero support team, I had the same problem, now everything is in order. The following is their answer.

Unfortunately, it looks like there was a problem with your database last night that caused a couple of hours off, however this is because it was restored by one of our call database engineers. This problem was not caused by you at all, it was a hardware failure on the host server.

Hope this helps.

+1
source

Now I have the same problem. I had no production data, so just create a new database. Very annoying though

Edit: just fixed when I migrated again

Edit 2: still broken. When I tried to run my second migration file, I get an error

 PG::DataCorrupted: ERROR: could not read block 1 in file "base/117039/12684": read only 0 of 8192 bytes 

Very annoying

Just tried to apply for a Heroku ticket. I filled out the form by downloading information and sent it only to receive a message stating that I did not create any support tickets!

-1
source

All Articles