Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/56.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails heroku运行rake db:迁移错误_Ruby On Rails_Postgresql_Heroku_Rails Migrations - Fatal编程技术网

Ruby on rails heroku运行rake db:迁移错误

Ruby on rails heroku运行rake db:迁移错误,ruby-on-rails,postgresql,heroku,rails-migrations,Ruby On Rails,Postgresql,Heroku,Rails Migrations,我想在heroku上的应用程序上运行迁移,但出现以下错误: Running `rake db:migrate` attached to terminal... up, run.1 DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them i

我想在heroku上的应用程序上运行迁移,但出现以下错误:

Running `rake db:migrate` attached to terminal... up, run.1
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
Migrating to CreateUsers (20120525005302)
Migrating to DeviseCreateUsers (20120611000411)
==  DeviseCreateUsers: migrating ==============================================
-- create_table(:users)
rake aborted!
An error has occurred, this and all later migrations canceled:

PGError: ERROR:  relation "users" already exists
: CREATE TABLE "users" ("id" serial primary key, "email" character varying(255) DEFAULT '' NOT NULL, "encrypted_password" character varying(255) DEFAULT '' NOT NULL, "reset_password_token" character varying(255), "reset_password_sent_at" timestamp, "remember_created_at" timestamp, "sign_in_count" integer DEFAULT 0, "current_sign_in_at" timestamp, "last_sign_in_at" timestamp, "current_sign_in_ip" character varying(255), "last_sign_in_ip" character varying(255), "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 

Tasks: TOP => db:migrate
正在运行附加到终端的'rake db:migrate'。。。起来,跑
弃用警告:在供应商/插件中有Rails 2.3风格的插件!对这些插件的支持将在Rails 4.0中删除。将它们移出并打包到您的Gemfile中,或者将它们作为lib/myplugin/*和config/initializers/myplugin.rb折叠到您的应用程序中。有关这方面的更多信息,请参阅发行说明:http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (从at/app/Rakefile:7调用)
弃用警告:在供应商/插件中有Rails 2.3风格的插件!对这些插件的支持将在Rails 4.0中删除。将它们移出并打包到您的Gemfile中,或者将它们作为lib/myplugin/*和config/initializers/myplugin.rb折叠到您的应用程序中。有关这方面的更多信息,请参阅发行说明:http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (从at/app/Rakefile:7调用)
弃用警告:在供应商/插件中有Rails 2.3风格的插件!对这些插件的支持将在Rails 4.0中删除。将它们移出并打包到您的Gemfile中,或者将它们作为lib/myplugin/*和config/initializers/myplugin.rb折叠到您的应用程序中。有关这方面的更多信息,请参阅发行说明:http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (从at/app/Rakefile:7调用)
迁移到CreateUsers(2012052505302)
迁移到DesiveCreateUsers(20120611000411)
==设计创建用户:正在迁移==============================================
--创建表格(:用户)
雷克流产了!
发生错误,此迁移和所有后续迁移已取消:
PGError:错误:关系“用户”已存在
:创建表“用户”(“id”序列主键,“电子邮件”字符变化(255)默认值“”不为空,“加密密码”字符变化(255)默认值“”不为空,“重置密码令牌”字符变化(255),“重置密码发送时间戳”,记住在“时间戳”创建时间戳,“签名计数”整数默认值0,“当前签名时间戳”,“时间戳处的最后一个符号”、“当前符号”字符变化(255)、“时间戳处的最后一个符号”字符变化(255)、“时间戳不为空时创建的”、“时间戳不为空时更新的”
任务:TOP=>db:migrate
我的github存储库中有以下迁移文件

  • 2012052505302_create_users.rb(为空,不知道如何删除)
  • 20120611000411_designe_create_users.rb
  • 20120613140535_create_authentications.rb

  • 看起来您已经有了设备\u create\u用户试图重新创建的表用户(可能来自create\u用户迁移)

    您可以修改create_device_users迁移,只添加所需的字段


    或者,如果它是一个没有用户的全新应用程序,您可以删除并尝试重新运行所有迁移

    ,看起来您已经有了设备创建用户试图重新创建的表用户(可能来自创建用户迁移)

    您可以修改create_device_users迁移,只添加所需的字段


    或者,如果它是一个没有用户的全新应用程序,您可以直接删除并尝试重新运行所有迁移操作

    ,看起来如下所示:

    • 2012052505302\u创建用户。rb
      将尝试在数据库中创建
      users
    • 20120611000411\u设计\u创建用户。rb
      还将尝试在数据库中创建
      users
    • 您的数据库当前已经有一个
      users
      表,因此第二次迁移失败
    要使数据库中的
    users
    表与
    20120611000411\u designe\u create\u users.rb
    迁移正确对应,可以执行以下两种操作之一:

  • 回滚(或删除)数据库,然后再次运行迁移。(如果为空,则可以删除
    2012052505302\u create\u users.rb
  • 修改您的
    20120611000411_designe_create_users.rb
    迁移以删除任何现有的
    users
    表,然后再执行其他操作
  • 修改您的
    20120611000411_designe_create_users.rb
    迁移,如下所示:
    • 修改现有表,而不是创建
      users
    • 添加和修改数据库组件以对应
  • 通常,如果您的应用程序处于“婴儿状态”,“然后,重新创建数据库往往是构建应用程序初始结构的一种快速方法。但是,如果
    users
    表中已经有重要数据,则需要保留这些数据,并通过修改
    20120611000411\u design\u create\u users.rb
    迁移来无破坏性地更改数据库

    参考资料


    看起来以下是正确的:

    • 2012052505302\u创建用户。rb
      将尝试在数据库中创建
      users
    • 20120611000411\u设计\u创建用户。rb
      还将尝试在数据库中创建
      users
    • 您的数据库当前已经有一个
      users
      表,因此第二次迁移失败
    要使数据库中的
    users
    表与
    20120611000411\u designe\u create\u users.rb
    迁移正确对应,可以执行以下两种操作之一:

  • 回滚(或删除)数据库,然后再次运行迁移。(如果
    2012052505302\u create\u users.rb
    为空,则可以将其删除。)
  • 修改您的
    20120611000411_designe_create_users.rb
    迁移以删除任何现有的
    users
    表,然后再执行其他操作
  • 修改您的
    20120611000411_designe_create_users.rb
    迁移,如下所示:
    • 修改现有表,而不是创建
      users
    • 添加和修改d