Class: Convergence::Command::Apply
Instance Method Summary
collapse
#initialize
Instance Method Details
#execute ⇒ Object
9
10
11
12
13
14
|
# File 'lib/convergence/command/apply.rb', line 9
def execute
current_dir_path = Pathname.new(@opts[:input]).realpath.dirname
input_tables = Convergence::DSL.parse(File.open(@opts[:input]).read, current_dir_path)
current_tables = dumper.dump
execute_sql(input_tables, current_tables)
end
|
#generate_sql(input_tables, current_tables) ⇒ Object
16
17
18
19
20
21
22
23
|
# File 'lib/convergence/command/apply.rb', line 16
def generate_sql(input_tables, current_tables)
current_tables_with_full_option =
Convergence::DefaultParameter.append_database_default_parameter(current_tables, database_adapter)
input_tables_with_full_option =
Convergence::DefaultParameter.append_database_default_parameter(input_tables, database_adapter)
delta = Convergence::Diff.new.diff(current_tables_with_full_option, input_tables_with_full_option)
sql_generator.generate(input_tables_with_full_option, delta, current_tables_with_full_option)
end
|