提交 b6d29976 编写于 作者: F Francesco Rodriguez

check if sqlite3 file exists before remove

上级 75714082
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
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册