/
database_config.rb
83 lines (64 loc) · 1.62 KB
/
database_config.rb
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# frozen_string_literal: true
module ActiveRecord
class DatabaseConfigurations
# ActiveRecord::Base.configurations will return either a HashConfig or
# UrlConfig respectively. It will never return a DatabaseConfig object,
# as this is the parent class for the types of database configuration objects.
class DatabaseConfig # :nodoc:
attr_reader :env_name, :name
attr_accessor :owner_name
def initialize(env_name, name)
@env_name = env_name
@name = name
end
def adapter_method
"#{adapter}_connection"
end
def host
raise NotImplementedError
end
def database
raise NotImplementedError
end
def _database=(database)
raise NotImplementedError
end
def adapter
raise NotImplementedError
end
def pool
raise NotImplementedError
end
def min_threads
raise NotImplementedError
end
def max_threads
raise NotImplementedError
end
def max_queue
raise NotImplementedError
end
def checkout_timeout
raise NotImplementedError
end
def reaping_frequency
raise NotImplementedError
end
def idle_timeout
raise NotImplementedError
end
def replica?
raise NotImplementedError
end
def migrations_paths
raise NotImplementedError
end
def for_current_env?
env_name == ActiveRecord::ConnectionHandling::DEFAULT_ENV.call
end
def schema_cache_path
raise NotImplementedError
end
end
end
end