SQLite is an extremely lightweight (dare I say agile) database. It uses files and doesn’t require you to start and stop services or spend a great deal of time configuring it. SQLite will be a good choice if you have a load under 100,000 requests and few concurrent writes. If you have a simple site that does nothing but serve content, then SQLite may just fit the bill.
Now that Ruby on Rails is using SQLite as its default database here are some tips for working with it.
Right off, you will need a Ruby SQLite adapter if you intend to work with SQLite at all, so let’s get that installed first:
sudo gem install sqlite3-ruby
Next up we need a database, and with SQLite all we need to do is pass a filename when we fire up SQLite:
At this point the database will operate similar to MySQL. You are sitting at a command prompt and can enter various SQL commands to create tables, perform crud operations etc.
When you are done with the database quit using the following command:
Another handy command to take a look at is:
This will produce a list of commands you can use in SQLite. For example, trying to find the equivalent of show databases in SQLite?
If you are not at all interested in working with SQLite or you know ahead of time it won’t fit the bill then let Rails know when you create your application:
rails -d mysql my_app