# Rake fails; path to sqlite database file problem

**URL:** <https://www.ruby-forum.com/t/rake-fails-path-to-sqlite-database-file-problem/121606>\
**Category:** Rails\
**Created:** [November 29, 2007, 7:59am UTC](https://www.ruby-forum.com/t/rake-fails-path-to-sqlite-database-file-problem/121606 "2007-11-29T07:59:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [November 29, 2007, 7:59am UTC](https://www.ruby-forum.com/t/rake-fails-path-to-sqlite-database-file-problem/121606/1 "2007-11-29T07:59:51Z")

</div>

Must I create a schema.sql? Given that rails creates the schema when  
using mySQL, why create schema.sql?

I have sqlite3 installed but am unsure about what the database.yml  
should  
look like and how the database file is found. I created an empty  
database and placed it in straw/db, but that doesn’t seem to work.

[http://wiki.rubyonrails.org/rails/pages/HowtoUseSQLite](http://wiki.rubyonrails.org/rails/pages/HowtoUseSQLite) says to:

sqlite3 ~/databases/rails-app.db \< /path/to/schema.sql

However, I never created a .sql file. Can’t I just plop straw.db  
somewhere and tell database.yml where to find it? This appears to be  
what happens in Windows.

For mySQL rails created all tables and schemas. Cannot rails do the  
same  
thing for sqLite?

Here’s what I have:

thufir@arrakis ~/rubyCode/straw $  
thufir@arrakis ~/rubyCode/straw $ cat db/migrate/001\_feeds.rb

class Feeds \< ActiveRecord::Migration  
def self.up  
create\_table :feeds do |table|  
table.column :title, :string  
table.column :location, :string  
table.column :category\_id, :integer  
end  
end  
def self.down  
drop\_table :feeds  
end  
end  
thufir@arrakis ~/rubyCode/straw $  
thufir@arrakis ~/rubyCode/straw $ ll db/straw.db  
-rw-r–r-- 1 thufir users 0 Nov 28 22:30 db/straw.db  
thufir@arrakis ~/rubyCode/straw $  
thufir@arrakis ~/rubyCode/straw $ cat config/database.yml

development:  
adapter: sqlite  
dbfile: /home/thufir/straw/db/straw.db  
test:  
adapter: sqlite  
dbfile: /home/thufir/straw/db/straw.db  
production:  
adapter: sqlite  
dbfile: /home/thufir/straw/db/straw.db  
thufir@arrakis ~/rubyCode/straw $  
thufir@arrakis ~/rubyCode/straw $ pwd  
/home/thufir/rubyCode/straw  
thufir@arrakis ~/rubyCode/straw $  
thufir@arrakis ~/rubyCode/straw $ rake db:migrate  
(in /home/thufir/rubyCode/straw)  
rake aborted!  
no such file to load – sqlite

(See full trace by running task with --trace)  
thufir@arrakis ~/rubyCode/straw $  
thufir@arrakis ~/rubyCode/straw $ eix dev-ruby/sqlite3-ruby  
[I] dev-ruby/sqlite3-ruby  
Available versions: 1.1.0 ~1.2.1 {doc swig}  
Installed versions: 1.1.0(21:15:58 11/28/07)(doc)  
Homepage: [http://rubyforge.org/projects/sqlite-ruby/](http://rubyforge.org/projects/sqlite-ruby/)  
Description: An extension library to access a SQLite  
database from Ruby

thufir@arrakis ~/rubyCode/straw $

thanks,

Thufir

---

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [November 29, 2007, 8:05am UTC](https://www.ruby-forum.com/t/rake-fails-path-to-sqlite-database-file-problem/121606/2 "2007-11-29T08:05:07Z")

</div>

On Thu, 29 Nov 2007 06:54:27 +0000, Thufir wrote:

> [http://wiki.rubyonrails.org/rails/pages/HowtoUseSQLite](http://wiki.rubyonrails.org/rails/pages/HowtoUseSQLite) says to:
> 
> sqlite3 ~/databases/rails-app.db \< /path/to/schema.sql

I’m still unsure as to what’s meant by schema.sql, but:

thufir@arrakis ~/rubyCode/straw/db $  
thufir@arrakis ~/rubyCode/straw/db $ sqlite3 straw.db  
SQLite version 3.4.1  
Enter “.help” for instructions  
sqlite\> .schema  
sqlite\> .quit  
thufir@arrakis ~/rubyCode/straw/db $

the idea is to create a shortcut? from what to what?

thanks,

Thufir
