class Rails::DataMapper::Storage::Sqlite

Public Instance Methods

_create() click to toggle source

This is a noop for sqlite

Overwritten solely for documentation purposes

Both auto_migrate!/auto_upgrade! will create the actual database if the connection has been setup properly and there actually are statements to execute (i.e. at least one model is declared)

Rails::DataMapper.setup alone won't create the actual database so there really is no API to simply create an empty database for sqlite3.

we return true to indicate success nevertheless

# File lib/dm-rails/storage.rb, line 133
def _create
  true
end
_drop() click to toggle source
# File lib/dm-rails/storage.rb, line 137
def _drop
  return if in_memory?
  path.unlink if path.file?
end
create_message() click to toggle source
# File lib/dm-rails/storage.rb, line 142
def create_message
  "[datamapper] db:create is a noop for sqlite3, use db:automigrate instead (#{database})"
end

Private Instance Methods

in_memory?() click to toggle source
# File lib/dm-rails/storage.rb, line 148
def in_memory?
  database == ':memory:'
end
path() click to toggle source
# File lib/dm-rails/storage.rb, line 152
def path
  @path ||= Pathname(File.expand_path(database, Rails.root))
end