Hi all,
I was asked to stand up a test server with OCW and after juggling gems all morning I'm at the point of trying to run the setup calls.
When I run: bundle exec rake db:create:all
It tells me this is only for a local database. I am in fact using a mysql database on another server so my question is, do I skip this step?
Assuming the above, I then run: bundle exec rake setup
It fails. Adding trace I learn the following...
** Invoke setup (first_time)
** Invoke setup:default (first_time)
** Invoke tmp:create (first_time)
** Execute tmp:create
** Invoke db:migrate:reset (first_time)
** Invoke db:drop (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:drop
rake aborted!
undefined method `[]' for nil:NilClass
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/tasks/databases.rake:410:in `drop_database'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/tasks/databases.rake:97:in `block (2 levels) in <top (required)>'
My understanding of the script syntax is minimal. It would appear it's complaining about either the use of brackets or the way they are used.
This being a blank database I thought maybe I could get away without the drop section so I removed it so it was just a begin and end block. That takes me to the create function where it also fails:
** Invoke setup (first_time)
** Invoke setup:default (first_time)
** Invoke tmp:create (first_time)
** Execute tmp:create
** Invoke db:migrate:reset (first_time)
** Invoke db:drop (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:drop
** Invoke db:create (first_time)
** Invoke db:load_config
** Execute db:create
rake aborted!
undefined method `[]' for nil:NilClass
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/tasks/databases.rake:55:in `rescue in create_database'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/tasks/databases.rake:35:in `create_database'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/tasks/databases.rake:31:in `block (2 levels) in <top (required)>'
So is the script broken? I'm also not 100% understanding the database config. I copied the mysl sample and changed the "default" in the database.yml to point to it.
default = "#{RAILS_ROOT}/config/database~mysql.yml"
In there I used a copy of a redmine config that works and substituted values:
common: &common
adapter: mysql
encoding: utf8
socket: <%= `mysql_config --socket`.chomp %>
username: ocw
password: *****
host: 123.456.789.012
database: ocw
So...typo, I screwed something up, combination of those....I could use a little help. Thanks.