首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Heroku pg迁移错误"PG:DataCorrupted: Error“

Heroku pg迁移错误"PG:DataCorrupted: Error“
EN

Stack Overflow用户
提问于 2014-05-01 02:31:55
回答 3查看 723关注 0票数 6

在尝试运行heroku run rake db:migrate时,我会得到以下错误。我试过heroku pg:reset,我试过heroku restart。我还试着创建一个新的应用程序,重新开始,但问题仍然存在。这里有什么问题吗?

代码语言:javascript
复制
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)

编辑我的迁移文件以创建通道表,如下所示(没有什么异常)

代码语言:javascript
复制
  class CreateChannels < ActiveRecord::Migration
    def change
      create_table :channels do |t|
        t.string :name
        t.integer :user_id

        t.timestamps
      end
    end
  end
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2014-05-01 15:14:38

我有同样的问题,我删除了数据库从https://dashboard.heroku.com/apps (这是海军)添加了一个新的PG数据库(这是蓝色的)

代码语言:javascript
复制
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

一切都成功了。我还是不知道为什么会这样!

票数 3
EN

Stack Overflow用户

发布于 2014-05-01 23:52:05

昨晚我联系了heroku支援队,我也有同样的问题,现在一切都恢复正常了。贝娄是他们的回应。

不幸的是,昨晚你的数据库出现了问题,导致了几个小时的中断,但是它后来被我们的一个待命数据库工程师恢复了。这个问题根本不是由您造成的,而是主机服务器上的硬件故障。

希望这能有所帮助。

票数 1
EN

Stack Overflow用户

发布于 2014-05-01 23:18:19

我现在也有同样的问题。我没有任何生产数据,所以将建立一个新的数据库。不过很烦人

编辑:刚刚修复了自己,当我再次运行迁移

编辑2:仍然是坏的。当我试图运行我的第二个迁移文件时,我得到了错误。

代码语言:javascript
复制
PG::DataCorrupted: ERROR:  could not read block 1 in file "base/117039/12684": read only 0 of 8192 bytes

很烦人

只是想给Heroku开一张罚单。填写表格上的大量信息,并提交只收到一条消息,说我没有创建任何支持票!

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23401201

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档