15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/fast_schema_dumper/cli.rb', line 15
def run(_argv)
env = ENV['RAILS_ENV'] || 'development'
database_yml_path = File.join(Dir.pwd, 'config', 'database.yml')
database_yml = Psych.safe_load(ERB.new(File.read(database_yml_path)).result, aliases: true)
config = database_yml[env]
config['pool'] = 1
hash_config = ActiveRecord::DatabaseConfigurations::HashConfig.new(env, 'primary', config)
ActiveRecord::Base.establish_connection(hash_config)
SchemaDumper.dump
0
end
|