2
我的應用程序適用於開發,我試圖將它部署到新的片。這個環境被稱爲'測試版'。一切似乎都工作正常,除了耙子試圖傳遞一個空白的數據庫名稱,無論是在capistrano中調用還是手動調用。我真的很感激任何幫助,因爲我不知道接下來要做什麼。谷歌搜索這沒有任何結果。Rails 3 - 嘗試創建/遷移空白數據庫名稱的Beta環境
謝謝 兔on Rails的
[email protected]:~/sites/darkserve/current$ rake db:drop
(in /home/ops/sites/darkserve/releases/20110218183444)
Couldn't drop : #<ActiveRecord::StatementInvalid: Mysql2::Error: Incorrect database name '': DROP DATABASE IF EXISTS ``>
[email protected]:~/sites/darkserve/current$ rake db:create
(in /home/ops/sites/darkserve/releases/20110218183444)
already exists
* executing "cd /home/ops/sites/darkserve/releases/20110218183444; bundle exec rake RAILS_ENV=beta db:migrate"
servers: ["173.203.106.112"]
[173.203.106.112:30000] executing command
*** [err :: 173.203.106.112:30000] rake aborted!
*** [err :: 173.203.106.112:30000]
*** [err :: 173.203.106.112:30000] Mysql2::Error: No database selected: SHOW TABLES
*** [err :: 173.203.106.112:30000]
*** [err :: 173.203.106.112:30000]
*** [err :: 173.203.106.112:30000] (See full trace by running task with --trace)
*** [err :: 173.203.106.112:30000]
** [out :: 173.203.106.112:30000] (in /home/ops/sites/darkserve/releases/20110218183444)
我已經嘗試了明顯的東西像按摩我的database.yml和beta.rb文件,但沒有成功。 Mysql正常工作並創建了正確的用戶。
common: &mysql
adapter: mysql2
host: localhost
encoding: utf8
username: root
password:
pool: 5
timeout: 5000
reconnect: true
development:
<<: *mysql
database: darkserve_development
test:
<<: *mysql
database: darkserve_test
beta:
<<: *mysql
database: darkserve_beta
production:
<<: *mysql
database: darkserve_prod
[email protected]:~/sites/darkserve/current$ mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 57
Server version: 5.1.41-3ubuntu12.9 (Ubuntu)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
+--------------------+
2 rows in set (0.00 sec)
mysql>
#beta.rb
Darkserve::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Specifies the header that your server uses for sending files
config.action_dispatch.x_sendfile_header = "X-Sendfile"
# For nginx:
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
# If you have no front-end server that supports something like X-Sendfile,
# just comment this out and Rails will serve the files
# See everything in the log (default is :info)
# config.log_level = :debug
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Use a different cache store in production
#config.cache_store = :mem_cache_store
# Disable Rails's static asset server
# In production, Apache or nginx will already do this
config.serve_static_assets = false
# Enable serving of images, stylesheets, and javascripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
config.action_mailer.delivery_method = :smtp
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
end
[email protected]:~/sites/darkserve/current$ ruby -v
ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-linux]
[email protected]:~/sites/darkserve/current$ rails -v
Rails 3.0.4
[email protected]:~/sites/darkserve/current$ irb
ruby-1.9.2-p136 :001 > require 'mysql'
=> true
你怎麼設置環境? – 2011-02-18 19:09:21
$貓〜/ .bash_profile中 出口RAILS_ENV =測試 – pendevere 2011-02-18 19:16:55