Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby ActiveRecord Basics Migrations and Relationships Migrations

can we use sqlite instead of mysql?

I am facing problem in creating the database using mysql ! can I continue Active Record Basics using sqlite as database?

ActiveRecord does support SQLite as well.

1 Answer

Yes! (I am not really good, but I am trying to answer you!) In your config/database.yml

change your code to the code below.

# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
#
default: &default
  adapter: sqlite3
  pool: 5
  timeout: 5000

development:
  <<: *default
  database: db/development.sqlite3

# 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:
  <<: *default
  database: db/test.sqlite3

production:
  <<: *default
  database: db/production.sqlite3
Christian Espinoza
Christian Espinoza
4,163 Points

What would be the sqlite version of mysql -uroot????

Christian Espinoza
Christian Espinoza
4,163 Points

as in how do I follow along with the Sqlite version of what he is doing on the command line?