blob: fff763421bf706656c4df12db38fa9fc9683b388 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
class ActiveRecord::Tasks::SQLiteDatabaseTasks
delegate :connection, :establish_connection, :to => ActiveRecord::Base
def initialize(configuration)
@configuration = configuration
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(Rails.root, path)
FileUtils.rm(file)
end
alias :purge :drop
private
attr_reader :configuration
end
|