I'm migrating from a sqllite db to mysql2. I have mysql running (and changed database.yml) but for some reason my rake db:create comes back with:
rake aborted!
Don't know how to build task 'db:create'
When I do a: rake -T, no db tasks appear in the list.
I'm on Rails 3.2.9
What obvious thing am I missing here?
Just figured it out. Someone had commented out the following in application.rb:
require 'rails/all'
Once put back rake -T returns the db tasks.
For people landing here in 2019:
If you ran rails new
with -O
(Capital 'O') or --skip-activerecord
and want to add a database later, you need to uncomment this in application.rb
to enable the Active Record framework:
require "active_record/railtie"
Edit:
You will also need to create the following structure in your application's root dir:
your_app
|_config
|_ database.yml
|_db
|_ migrate
|_ schema.rb
then run:rake db:schema:dump
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With