Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 7fd7747497
Fetching contributors…

Cannot retrieve contributors at this time

41 lines (32 sloc) 0.894 kB
module ActiveRecord
module Tasks # :nodoc:
class SQLiteDatabaseTasks # :nodoc:
delegate :connection, :establish_connection, to: ActiveRecord::Base
def initialize(configuration, root = Rails.root)
@configuration, @root = configuration, root
end
def create
if File.exist?(configuration['database'])
$stderr.puts "#{configuration['database']} already exists"
return
end
establish_connection configuration
connection
end
def drop
require 'pathname'
path = Pathname.new configuration['database']
file = path.absolute? ? path.to_s : File.join(root, path)
FileUtils.rm(file) if File.exist?(file)
end
alias :purge :drop
private
def configuration
@configuration
end
def root
@root
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.