Reputation: 96777
Here's what I'm using to create my database:
DataMapper.setup(:default,"sqlite://my.db")
class Model1
property :some_prop,String
...
property :other_prop,String
end
DataMapper.auto_upgrade!
I'm using this in combination with Sinatra. Everything's ok while the script is running, I can use my objects normally. However, I see no file my.db
on the disk, and everytime I'm restarting the application, I start from scratch, without any objects.
What am I doing wrong?
Upvotes: 3
Views: 1890
Reputation: 11736
DataMapper.setup(:default, "sqlite3://#{Dir.pwd}/my.db")
# your schema
DataMapper.finalize
DataMapper.auto_upgrade!
Also see docs.
Upvotes: 0
Reputation: 124419
Try putting the full path in there (note there are 3 forward slashes):
DataMapper.setup(:default, "sqlite:///path/to/my/database/my.db")
Then you should see my.db
under /path/to/my/database/
Upvotes: 3