无法将迁移推送到 Heroku
Unable to push migrations to Heroku
我在 Heroku 上有一个 rails 应用程序。我可以连接到它,推送构建,然后看到它 运行ning.
问题:我无法在 db>migrate 文件夹中推送包含迁移的构建。任何这样做的尝试都会给我一个
的错误
remote: Run `bin/rails db:migrate` to update your database then try again. remote: You have 3 pending migrations: remote: 20210326003113 CreateUsers remote: 20210326004504 CreateAlerts remote: 20210326004819 CreateContacts remote: Waiting for release.... failed. To https://git.heroku.com/*appname* 3dca123..cc0f499 master -> master
我 运行 我在本地迁移,提交,在本地测试它们(它们工作),然后以与上面相同的响应推送到 heroku。
我可以运行heroku run bin/rails db:migrate
这给了我一堆警告的回应。
// ♥ heroku run bin/rails db:migrate -a *app name*
Running bin/rails db:migrate on ⬢ *app name*... up, run.1211 (Free)
/app/vendor/bundle/ruby/2.6.0/gems/bundler-2.2.11/lib/bundler/rubygems_integration.rb:12: warning: already initialized constant Bundler::RubygemsIntegration::EXT_LOCK
/app/vendor/ruby-2.6.1/lib/ruby/2.6.0/bundler/rubygems_integration.rb:12: warning: previous definition of EXT_LOCK was here
/app/vendor/bundle/ruby/2.6.0/gems/bundler-2.2.11/lib/bundler/version.rb:4: warning: already initialized constant Bundler::VERSION
/app/vendor/ruby-2.6.1/lib/ruby/2.6.0/bundler/version.rb:10: warning: previous definition of VERSION was here
/app/vendor/bundle/ruby/2.6.0/gems/bundler-2.2.11/lib/bundler/constants.rb:4: warning: already initialized constant Bundler::WINDOWS
/app/vendor/ruby-2.6.1/lib/ruby/2.6.0/bundler/constants.rb:4: warning: previous definition of WINDOWS was here
/app/vendor/bundle/ruby/2.6.0/gems/bundler-2.2.11/lib/bundler/constants.rb:5: warning: already initialized constant Bundler::FREEBSD
/app/vendor/ruby-2.6.1/lib/ruby/2.6.0/bundler/constants.rb:5: warning: previous definition of FREEBSD was here
/app/vendor/bundle/ruby/2.6.0/gems/bundler-2.2.11/lib/bundler/constants.rb:6: warning: already initialized constant Bundler::NULL
/app/vendor/ruby-2.6.1/lib/ruby/2.6.0/bundler/constants.rb:6: warning: previous definition of NULL was here
/app/vendor/bundle/ruby/2.6.0/gems/bundler-2.2.11/lib/bundler/current_ruby.rb:12: warning: already initialized constant Bundler::CurrentRuby::KNOWN_MINOR_VERSIONS
/app/vendor/ruby-2.6.1/lib/ruby/2.6.0/bundler/current_ruby.rb:12: warning: previous definition of KNOWN_MINOR_VERSIONS was here
/app/vendor/bundle/ruby/2.6.0/gems/bundler-2.2.11/lib/bundler/current_ruby.rb:25: warning: already initialized constant Bundler::CurrentRuby::KNOWN_MAJOR_VERSIONS
/app/vendor/ruby-2.6.1/lib/ruby/2.6.0/bundler/current_ruby.rb:24: warning: previous definition of KNOWN_MAJOR_VERSIONS was here
/app/vendor/bundle/ruby/2.6.0/gems/bundler-2.2.11/lib/bundler/current_ruby.rb:27: warning: already initialized constant Bundler::CurrentRuby::KNOWN_PLATFORMS
/app/vendor/ruby-2.6.1/lib/ruby/2.6.0/bundler/current_ruby.rb:26: warning: previous definition of KNOWN_PLATFORMS was here
检查日志,它告诉我无法创建用户,因为我的用户 table 不存在。用户 table 不存在,因为没有迁移。使用 heroku run rake db:migrate
没有任何作用,因为 Heroku 上的构建不包含任何迁移。我无法推送带有迁移的构建,因为它告诉我有待处理的迁移。
任何有关此第 22 条军规的帮助都将非常有用。如果需要,可以随时 post 日志。
解决方案在我的 Procfile 中。
我需要使用 bundle exec rails s
。
在我使用 release: bin/rails db:migrate
之前
我在 Heroku 上有一个 rails 应用程序。我可以连接到它,推送构建,然后看到它 运行ning.
问题:我无法在 db>migrate 文件夹中推送包含迁移的构建。任何这样做的尝试都会给我一个
的错误remote: Run `bin/rails db:migrate` to update your database then try again. remote: You have 3 pending migrations: remote: 20210326003113 CreateUsers remote: 20210326004504 CreateAlerts remote: 20210326004819 CreateContacts remote: Waiting for release.... failed. To https://git.heroku.com/*appname* 3dca123..cc0f499 master -> master
我 运行 我在本地迁移,提交,在本地测试它们(它们工作),然后以与上面相同的响应推送到 heroku。
我可以运行heroku run bin/rails db:migrate
这给了我一堆警告的回应。
// ♥ heroku run bin/rails db:migrate -a *app name*
Running bin/rails db:migrate on ⬢ *app name*... up, run.1211 (Free)
/app/vendor/bundle/ruby/2.6.0/gems/bundler-2.2.11/lib/bundler/rubygems_integration.rb:12: warning: already initialized constant Bundler::RubygemsIntegration::EXT_LOCK
/app/vendor/ruby-2.6.1/lib/ruby/2.6.0/bundler/rubygems_integration.rb:12: warning: previous definition of EXT_LOCK was here
/app/vendor/bundle/ruby/2.6.0/gems/bundler-2.2.11/lib/bundler/version.rb:4: warning: already initialized constant Bundler::VERSION
/app/vendor/ruby-2.6.1/lib/ruby/2.6.0/bundler/version.rb:10: warning: previous definition of VERSION was here
/app/vendor/bundle/ruby/2.6.0/gems/bundler-2.2.11/lib/bundler/constants.rb:4: warning: already initialized constant Bundler::WINDOWS
/app/vendor/ruby-2.6.1/lib/ruby/2.6.0/bundler/constants.rb:4: warning: previous definition of WINDOWS was here
/app/vendor/bundle/ruby/2.6.0/gems/bundler-2.2.11/lib/bundler/constants.rb:5: warning: already initialized constant Bundler::FREEBSD
/app/vendor/ruby-2.6.1/lib/ruby/2.6.0/bundler/constants.rb:5: warning: previous definition of FREEBSD was here
/app/vendor/bundle/ruby/2.6.0/gems/bundler-2.2.11/lib/bundler/constants.rb:6: warning: already initialized constant Bundler::NULL
/app/vendor/ruby-2.6.1/lib/ruby/2.6.0/bundler/constants.rb:6: warning: previous definition of NULL was here
/app/vendor/bundle/ruby/2.6.0/gems/bundler-2.2.11/lib/bundler/current_ruby.rb:12: warning: already initialized constant Bundler::CurrentRuby::KNOWN_MINOR_VERSIONS
/app/vendor/ruby-2.6.1/lib/ruby/2.6.0/bundler/current_ruby.rb:12: warning: previous definition of KNOWN_MINOR_VERSIONS was here
/app/vendor/bundle/ruby/2.6.0/gems/bundler-2.2.11/lib/bundler/current_ruby.rb:25: warning: already initialized constant Bundler::CurrentRuby::KNOWN_MAJOR_VERSIONS
/app/vendor/ruby-2.6.1/lib/ruby/2.6.0/bundler/current_ruby.rb:24: warning: previous definition of KNOWN_MAJOR_VERSIONS was here
/app/vendor/bundle/ruby/2.6.0/gems/bundler-2.2.11/lib/bundler/current_ruby.rb:27: warning: already initialized constant Bundler::CurrentRuby::KNOWN_PLATFORMS
/app/vendor/ruby-2.6.1/lib/ruby/2.6.0/bundler/current_ruby.rb:26: warning: previous definition of KNOWN_PLATFORMS was here
检查日志,它告诉我无法创建用户,因为我的用户 table 不存在。用户 table 不存在,因为没有迁移。使用 heroku run rake db:migrate
没有任何作用,因为 Heroku 上的构建不包含任何迁移。我无法推送带有迁移的构建,因为它告诉我有待处理的迁移。
任何有关此第 22 条军规的帮助都将非常有用。如果需要,可以随时 post 日志。
解决方案在我的 Procfile 中。
我需要使用 bundle exec rails s
。
在我使用 release: bin/rails db:migrate