5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/rare_map/model_builder.rb', line 5
def build_models(db_profiles)
models = []
db_profiles.each do |db_prof|
db_prof.tables.each do |table|
opts = db_prof.options
set_primary_key_by_options(table, opts)
set_foreign_keys_by_options(table, opts)
set_fk_suffix_by_options(table, opts)
if opts.group?
models << Model.new(db_prof.connection, table, opts.group, db_prof.name)
else
models << Model.new(db_prof.connection, table, 'default', db_prof.name)
end
end
end
build_relations models
models
end
|