Skip to content

Commit

Permalink
check if sqlite3 file exists before remove
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesco Rodriguez committed Jun 18, 2012
1 parent 7571408 commit b6d2997
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions activerecord/lib/active_record/tasks/sqlite_database_tasks.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
class ActiveRecord::Tasks::SQLiteDatabaseTasks
delegate :connection, :establish_connection, :to => ActiveRecord::Base
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']
if File.exist?(configuration['database'])
$stderr.puts "#{configuration['database']} already exists"
return
end
Expand All @@ -20,7 +20,7 @@ def drop
path = Pathname.new configuration['database']
file = path.absolute? ? path.to_s : File.join(root, path)

FileUtils.rm(file)
FileUtils.rm(file) if File.exist?(file)
end

alias :purge :drop
Expand Down

0 comments on commit b6d2997

Please sign in to comment.