As long as the config\database.yml file looks like
Code:
development:
adapter: sqlite3
database: db/development.sqlite3
timeout: 5000
test:
adapter: sqlite3 database:
db/test.sqlite3
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
timeout: 5000
then
Code:
shovell>sqlite3 db/development
specifies which database to use (i.e. "development") so there is no need to use a "USE [db name]"
The book shows this query syntax
Code:
CREATE TABLE stories (
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
"name" varchar(255) DEFAULT NULL,
"link" varchar(255) DEFAULT NULL,
"created_at" datetime DEFAULT NULL,
"updated_at" datetime DEFAULT NULL
);
NOT
Code:
CREATE TABLE `stories` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) default NULL,
`link` varchar(255) default NULL,
PRIMARY KEY (`id`)
);
which is what the archive's 02-create-stories-table.sql file has. This has caused a problem before. From the book's errata page http://www.sitepoint.com/books/rails2/errata.php (take a look so you won't get stung by other typos)
p.102, 1st code listing
The SQL code in the book is correct, the code in the code archive is incorrect.
Bookmarks