Class: RailsParallel::Schema
- Inherits:
-
Object
- Object
- RailsParallel::Schema
show all
- Includes:
- Forks
- Defined in:
- lib/rails_parallel/schema.rb
Instance Method Summary
collapse
Methods included from Forks
#before_exit, #check_status, #fork_and_run, #wait_any, #wait_for
Constructor Details
#initialize(file) ⇒ Schema
7
8
9
|
# File 'lib/rails_parallel/schema.rb', line 7
def initialize(file)
@file = file
end
|
Instance Method Details
#load_db(number) ⇒ Object
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/rails_parallel/schema.rb', line 28
def load_db(number)
update_db_config(number)
if schema_loaded?
reconnect
false
else
schema_load
true
end
end
|
#load_main_db ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/rails_parallel/schema.rb', line 11
def load_main_db
if load_db(1)
failed = 0
ObjectSpace.each_object(Class) do |klass|
next unless klass < ActiveRecord::Base
klass.reset_column_information
begin
klass.columns
rescue StandardError => e
failed += 1
raise e if failed > 3
end
end
end
end
|