提交 89c8affe 编写于 作者: P Pratik Naik

Use Pathname for checking if sqlite path is absolute

上级 071f48b7
......@@ -440,7 +440,11 @@ def drop_database(config)
ActiveRecord::Base.establish_connection(config)
ActiveRecord::Base.connection.drop_database config['database']
when /^sqlite/
FileUtils.rm((config['database'] =~ /^\// ? config['database'] : File.join(RAILS_ROOT, config['database'])))
require 'pathname'
path = Pathname.new(config['database'])
file = path.absolute? ? path.to_s : File.join(RAILS_ROOT, path)
FileUtils.rm(file)
when 'postgresql'
ActiveRecord::Base.establish_connection(config.merge('database' => 'postgres', 'schema_search_path' => 'public'))
ActiveRecord::Base.connection.drop_database config['database']
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册