<— Tutorial | TutorialStepTwo —>
First of all, if you haven’t already done so, install sqlite 2.8.x (or 3) and the sqlite binding (e.g from rubygems “gem install sqlite3-ruby”). Either version 1.3.x or 2.x or 3.x should work fine. Then, you have two options to initialize the DB. By hand (the old way) or using migrations.
See instructions at TutorialStepOneMigrations
sqlite mytest.db
Then paste the following code into the sqlite command line.
CREATE TABLE people ( id INTEGER PRIMARY KEY, name TEXT, street1 TEXT, street2 TEXT, city TEXT, state TEXT, zip TEXT ); INSERT INTO people VALUES (1, 'Superman', '123 Somewhere', '', 'Smallville', 'KS', '123456');
Finally, to exit the sqlite interface type
.exit
A faster way to do the above is to paste the creation
sql into a file, then run sqlite as follows:
sqlite rails_production.db < my.sql
sqlite mytest.db “create table people (id INTEGER PRIMARY KEY,name TEXT,street1 TEXT,street2 TEXT,city TEXT, state TEXT, zip TEXT);”
and populate the database like this:
sqlite mytest.db “insert into people (name,street1,street2,city,state,zip) values ( ‘Superman’, ‘123 Somewhere’, ‘’, ’Smallville’, ‘KS’, ’123456’);”
<— Tutorial | TutorialStepTwo —>
category:Tutorial