blob: d0d3ea12dd7b1d5475fdf1ef7f37f2e104cbc227 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
class ActiveRecord::Tasks::DatabaseTasks
TASKS_PATTERNS = {
/mysql/ => ActiveRecord::Tasks::MySQLDatabaseTasks,
# /postgresql/ => ActiveRecord::Tasks::PostgreSQLTasker,
/sqlite/ => ActiveRecord::Tasks::SQLiteDatabaseTasks
}
def self.create(configuration)
class_for_adapter(configuration['adapter']).new(configuration).create
rescue Exception => e
$stderr.puts e, *(e.backtrace)
$stderr.puts "Couldn't create database for #{configuration.inspect}"
end
def self.class_for_adapter(adapter)
key = TASKS_PATTERNS.keys.detect { |key| adapter[key] }
TASKS_PATTERNS[key]
end
end
|