Run Specs error: Couldn't load the Unicode tables for - ruby-on-rails

I tried to run my specs but I got the following error:
No DRb server is running. Running in local process instead ...
1) FinancialAccountsQuery parcial_future_releases LIMIT_DATE_FILTER transactions
Failure/Error: let(:financial_account) { FactoryGirl.create(:financial_account_with_church) }
IOError:
Couldn't load the Unicode tables for UTF8Handler (dump format error(0x6b)), ActiveSupport::Multibyte is unusable
# ./spec/queries/financial_accounts_query_spec.rb:4:in `block (2 levels) in <top (required)>'
# ./spec/queries/financial_accounts_query_spec.rb:106:in `create_transaction'
# ./spec/queries/financial_accounts_query_spec.rb:8:in `block (3 levels) in <top (required)>'
I tried to drop all the databases with rake db:drop, then create them again with rake db:create and rake db:migrate, but nothing seems to solve it.
My database.yml
development:
adapter: "mysql2"
encoding: "utf8"
database: "ibc1"
username: "root"
password: ""
host: 127.0.0.1
test:
adapter: "mysql2"
encoding: "utf8"
database: "gi_test"
username: "root"
password: ""
host: 127.0.0.1
Anyone has any idea to solve this ?
Thanks :)

Related

Rake db:migrate rails with error undefined method `session_store_host`

I have several databases across various geolocations. Each has its own representation in my database.yml file.
When running RAILS_ENV=europe rake db:migrate I am getting the following error
undefined method `session_store_host' for #<Rails::Application::Configuration:0x000000038fdda8>
Stack:
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.17/lib/rails/railtie/configuration.rb:85:in `method_missing'
/var/www/vhosts/adm.dyqa.io/html/releases/20190324134144/config/initializers/session_store.rb:9:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:245:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:245:in `block in load'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:236:in `load_dependency'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:245:in `load'
My database file:
europe:
adapter: mysql2
encoding: utf8
reconnect: true
database: production
pool: 10
username: USERNAME
password: PASSWORD
host: database.mycompany.europe
port: 1234
danger:
adapter: mysql2
encoding: utf8
reconnect: true
database: production
pool: 10
username: USERNAME
password: PASSWORD
host: database.mycompany.usa
port: 1234
Turns out I was missing the config file europe.rb
After creating that, the migration ran successfully.

KeyError: Cannot load `Rails.application.database_configuration`: key not found: "DB_ENV_POSTGRESQL_USER"

So I have been looking everywhere to try and find a solution to this and i have had no luck up to now. I'm ruby on rails so i could very well be missing something basic or be looking in the wrong place for the solution, so i thought i'd just ask. I have a rails API which i forked from my organization and I want to run it locally. I got stuck running this line in the terminal
bundle exec rake create:db
and got this error, I don't really know what to do :/ If this question has already been answered just point me there and i'll go figure it out! Thank you.
Admins-MacBook-Pro:environments nathanshanko$ bundle exec rake db:create
(in /Users/nathanshanko/Desktop/git-repos/voke_api)
rake aborted!
KeyError: Cannot load `Rails.application.database_configuration`:
key not found: "DB_ENV_POSTGRESQL_USER"
(erb):7:in `fetch'
(erb):7:in `'
/Users/nathanshanko/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/application/configuration.rb:104:in `database_configuration'
/Users/nathanshanko/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.6/lib/active_record/railtie.rb:41:in `block (3 levels) in '
/Users/nathanshanko/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
/Users/nathanshanko/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `'
KeyError: key not found: "DB_ENV_POSTGRESQL_USER"
(erb):7:in `fetch'
(erb):7:in `'
/Users/nathanshanko/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/application/configuration.rb:104:in `database_configuration'
/Users/nathanshanko/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.6/lib/active_record/railtie.rb:41:in `block (3 levels) in '
/Users/nathanshanko/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
/Users/nathanshanko/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `'
Tasks: TOP => db:create => db:load_config
(See full trace by running task with --trace)
Here is my database.yml file
common: &common
adapter: postgresql
encoding: utf8
reconnect: true
pool: <%= ENV['DB_ENV_POSTGRESQL_POOL'] || 5 %>
database: <%= ENV['DB_ENV_POSTGRESQL_DB'] || 'voke_api' %>
username: <%= ENV.fetch('DB_ENV_POSTGRESQL_USER') %>
password: <%= ENV['DB_ENV_POSTGRESQL_PASS'] %>
host: <%= ENV.fetch('DB_PORT_5432_TCP_ADDR') %>
port: <%= ENV['DB_PORT_5432_TCP_PORT'] %>
development:
<<: *common
production:
<<: *common
staging:
<<: *common
test:
<<: *common
It sounds like you're missing some env vars that define your database credentials. You'll want to set these up (either via the command line, or something like a .env or application.yml file, depending on your project set up).
The error you're getting on DB_ENV_POSTGRESQL_USER is due to the ENV.fetch, which raises an IndexError if the key isn't found. You may also be missing other env vars, but ENV['xyz'] will fail silently without throwing any errors.

rake aborted error while implementing db:drop in rails 3.2

I am new to rails.I was trying rake db:drop but am getting the following error
rake aborted!
(<unknown>): mapping values are not allowed in this context at line 21 column 12
/home/chiron/.rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.11/lib/rails/application/configuration.rb:115:in `database_configuration'
/home/chiron/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.11/lib/active_record/railties/databases.rake:25:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:drop => db:load_config
(See full trace by running task with --trace)
I am installing on ubuntu.While working the same code for windows environment it seems to work perfectly
My database.yml is as follows:-
# PostgreSQL v0.8.x
# gem install pg
development:
adapter: postgresql
encoding: unicode
host: localhost
database: lib_development
pool: 5
username: chiron
password:
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: postgresql
encoding: unicode
host: localhost
database: lib_test
pool: 5
username: chiron
password:
production:
adapter: postgresql
encoding: unicode
host: localhost
database: lib_production
pool: 5
username: chiron
password:
Can anyone please help me
you have redundant spacebar in config
pool: 5
username: chiron # << here
password:

Resetting Test Database via rake test is complaining: "database configuration does not specify adapter"

I am attempting to use this bit of useful code from this question:
namespace :db do
namespace :test do
task :reset do
ActiveRecord::Base.establish_connection('test')
Rake::Task['db:drop'].invoke
Rake::Task['db:create'].invoke
Rake::Task['db:migrate'].invoke
ActiveRecord::Base.establish_connection(ENV['RAILS_ENV']) #Make sure you don't have side-effects!
end
end
end
Unfortunately I am getting this error:
** Invoke db:test:reset (first_time)
** Execute db:test:reset
rake aborted!
database configuration does not specify adapter
/home/nick/.rvm/gems/ruby-1.9.3-p194/gems/activerecord- 3.2.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:45:in `resolve_hash_connection'
/home/nick/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:39:in `resolve_string_connection'
/home/nick/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:25:in `spec'
/home/nick/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.5/lib/active_record/connection_adapters/abstract/connection_specification.rb:127:in `establish_connection'
/home/nick/Projects/yumbin/lib/tasks/test_environment.rake:4:in `block (3 levels) in <top (required)>'
/home/nick/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/home/nick/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/home/nick/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/home/nick/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/home/nick/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/home/nick/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/nick/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/home/nick/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/home/nick/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/home/nick/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/home/nick/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/home/nick/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/home/nick/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/nick/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/home/nick/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/home/nick/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/nick/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/home/nick/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
./bundler_stubs/rake:16:in `load'
./bundler_stubs/rake:16:in `<main>'
Tasks: TOP => db:test:reset
As you can see I am using Ruby 1.9.3 via RVM. I am using Rails 3.2.5, Rake version 0.9.2.2 and Postgresql 9.1, and the pg gem (0.13.2). Additionally, I have no database errors in my environments. Thhe app is deployed and running on Heroku, runs locally in development, and I can run my full test suite without issue. In a Rails console running the line:
ActiveRecord::Base.establish_connection('test')
succeeds. I checked the database.yml in vi for invisible characters but could not find any. Only '$' at the end of each line. I'm starting to think that the answer is incredibly simple and in front of my nose but I just can't see it.
UPDATE: Adding my database.yml file:
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: postgresql
encoding: unicode
database: myapp-dev
pool: 5
username: ******
password: *******
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: postgresql
encoding: unicode
database: myapp-test
pool: 5
username: *****
password: ******
production:
adapter: postgresql
encoding: unicode
database: myapp
pool: 5
username: ******
password: *******
You need a test entry in your database.yml file, and I think you're probably lacking one. Make sure you have an entry that looks like this in database.yml:
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
Using whatever adapter and database your development database is using.

rake db:migrate and rake db:create both work on test database, not development database

I am new to Stack Overflow and Ruby on Rails. My problem is, when I run the command rake db:create or rake db:migrate, the test database is affected, but the development database is not.
rails (3.2.2)
my database.yml:
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test: &test
adapter: postgresql
encoding: unicode
database: ticketee_test
pool: 5
username: ticketee
password: my_password_here
development:
adapter: postgresql
encoding: unicode
database: ticketee_development
pool: 5
username: ticketee
password: my_password_here
production:
adapter: postgresql
encoding: unicode
database: ticketee_production
pool: 5
username: ticketee
password: my_password_here
cucumber:
<<: *test
Thanks for the suggestion, but I am afraid that isn't the reason. My RAILS_ENV=development. When I start the rails server, the server runs the development database. if I run "rails server -e test" then the server uses the test database. I am still not sure why migrations are running on my test database...
UPDATE:
Based on a suggestion, I commented out all of the database configurations except development, and now I get an error. I am running postgresql, I have the gem 'pg' installed. First, my new database.yml:
development:
adapter: postgresql
encoding: unicode
database: ticketee_development
pool: 5
username: ticketee
password: my_password_here
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
#test: &test
# adapter: postgresql
# encoding: unicode
# database: ticketee_test
# pool: 5
# username: ticketee
# password: my_password_here
#production:
# adapter: postgresql
# encoding: unicode
# database: ticketee_production
# pool: 5
# username: ticketee
# password: my_password_here
#cucumber:
# <<: *test
My error message!
Someguys-MacBook-Air:ticketee someguy$ rake db:migrate
rake aborted!
database configuration does not specify adapter
Tasks: TOP => db:migrate => db:load_config
(See full trace by running task with --trace)
Someguys-MacBook-Air:ticketee someguy$ rake db:migrate -t
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
rake aborted!
database configuration does not specify adapter
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:45:in `resolve_hash_connection'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:39:in `resolve_string_connection'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:23:in `spec'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:127:in `establish_connection'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/activerecord-3.2.2/lib/active_record/railtie.rb:76:in `block (2 levels) in <class:Railtie>'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/activesupport-3.2.2/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/activesupport-3.2.2/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/activesupport-3.2.2/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/activesupport-3.2.2/lib/active_support/lazy_load_hooks.rb:42:in `each'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/activesupport-3.2.2/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/activerecord-3.2.2/lib/active_record/base.rb:718:in `<top (required)>'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/activerecord-3.2.2/lib/active_record/railties/databases.rake:6:in `block (2 levels) in <top (required)>'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/someguy/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
/Users/someguy/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/bin/rake:19:in `load'
/Users/someguy/.rvm/gems/ruby-1.9.3-p125#defaultGems/bin/rake:19:in `<main>'
Using the database.yml above, rake db:create:all RAN CORRECTLY and created my table. However, my migration still fails with the same stack trace as the one above.
I changed my database.yml to this:
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000
UPDATE: I completely changed my database.yml to this:
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
test: &test
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000
cucumber:
<<: *test
Now, this is what happens when I run rake db:drop:all, followed by rake db:migrate. The rake db:migrate command runs a migration, creating a db/test.sqlite3 AND adding a table to it. So, my migration is still running on the test environment. When I run rake environment RAILS_ENV=development db:migrate, the same thing happens and I get a test.sqlite3 file...
There is a 'brilliant' line in
activerecord/lib/active_record/tasks/database_tasks.rb:
environments << 'test' if environment == 'development' && ENV['RAILS_ENV'].nil?
which, until jan 8, 2014 looked like:
environments << 'test' if environment == 'development'
I had the exact same problem starting last night. No idea what might have caused this, but finally found a solution that worked. Inside the configure block in config/environments/develop.rb, I added:
Rails.env = 'development'
I hope that works for you too
It sounds like your solution could be involving a couple of things. It's possible your your environment is confusing the migration because of existing elements. Reset your database using:
rake db:reset
or
rake db:drop db:create
depending on your environment, you should be able to do the migration.
rake db:migrate
PS - You may have to add bundle exec in the beginning of each command.
Good luck.
You are missing the host: localhost in your yml file.
Change your configuration to this:
development:
adapter: postgresql
encoding: unicode
host: localhost
database: ticketee_development
pool: 5
username: ticketee
password: my_password_here
Forking error!
Maybe some caching or log problems It shows that nothing of the errors in our code.
My team resolve it.
delete the project
git clone the project
config the database.yml
start server
Everything is okay!
The same project the errors gone!
So we think it is env problems or cach or log.
You can use rake db:migrate RAILS_ENV="development"
or you can use like
set RAILS_ENV=development
rake db:migrate

Resources