gpt4 book ai didi

mysql - 为什么数据库迁移过程中gemfile中找不到mysql gem?

转载 作者:行者123 更新时间:2023-11-29 12:43:09 25 4
gpt4 key购买 nike

我正在尝试使用 mina 部署我的first_app当我调用 mina deploy -t 时,一切都会顺利进行,直到开始迁移数据库。这是我遇到的错误。

Migrating database
$ RAILS_ENV="production" bundle exec rake db:migrate
rake aborted!
Gem::LoadError: Specified 'mysql' for database adapter, but the gem is not loaded.
Add `gem 'mysql'` to your Gemfile.

所以我去了我的 Gemfile

source 'https://rubygems.org'   
ruby '2.0.0'
gem 'mina', '0.3.0'
#ruby-gemset=railstutorial_rails_4_0


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.8'
gem 'mysql', '~> 2.9.1'

#group :development do
# Use sqlite3 as the database for Active Record
# gem 'sqlite3', '1.3.8'
#end

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 2.1.1'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '4.0.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails', '3.0.4'
# Turbolinks makes following links in your web application faster. Read more:
gem 'turbolinks', '1.1.1'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '1.0.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '0.3.20', require: false
end
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]

所以 gem 就在那里,当我运行 bundle install 时,它会被列出,而不是在一个组中,对于那些知道如果您使用 则 bundler 可以记住这一事实的人来说,它不在一个组中--withoutdevelopment 选项,并且不会包含开发组中的 gem。当 Icat 运行时进一步

.
.
.
Using json 1.8.1
Using open4 1.3.4
Using mina 0.3.0
Using mysql 2.9.1
Using bundler 1.7.2
Using tilt 1.4.1
.
.
.

在 mina 部署期间运行

 $ bundle install --without development:test --path "./vendor/bundle" --binstubs bin/  
--deployment
Using rake 10.3.2
Using i18n 0.6.11
Using minitest 4.7.5
Using multi_json 1.10.1
Using thread_safe 0.3.4
Using tzinfo 0.3.41
Using activesupport 4.0.8
Using builder 3.1.4
Using erubis 2.7.0
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.0.8
Using mime-types 1.25.1
Using polyglot 0.3.5
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 4.0.8
Using activemodel 4.0.8
Using activerecord-deprecated_finders 1.0.3
Using arel 4.0.2
Using activerecord 4.0.8
Using coffee-script-source 1.8.0
Using execjs 2.2.1
Using coffee-script 2.3.0
Using thor 0.19.1
Using railties 4.0.8
Using coffee-rails 4.0.1
Using hike 1.2.3
Using jbuilder 1.0.2
Using jquery-rails 3.0.4
Using json 1.8.1
Using bundler 1.7.2
Using tilt 1.4.1
Using sprockets 2.11.0
Using sprockets-rails 2.1.4
Using rails 4.0.8
Using rdoc 3.12.2
Using sass 3.2.19
Using sass-rails 4.0.3
Using sdoc 0.3.20
Using turbolinks 1.1.1
Using uglifier 2.5.3
Your bundle is complete!
Gems in the groups development and test were not installed.

所以我在这里缺少什么,我觉得它与 mina 在捆绑过程中包含和排除的组有关。任何帮助将不胜感激。

最佳答案

mysql2 是 MySQL 的较新 gem,您应该配置 database.ymlGemfile 以使用它而不是 mysql.

关于mysql - 为什么数据库迁移过程中gemfile中找不到mysql gem?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25838616/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com