Module: TurboTest::StaticAnalysis::ActiveRecord

Defined in:
lib/turbo_test_static_analysis/active_record_schema.rb,
lib/turbo_test_static_analysis/active_record_schema/map.rb,
lib/turbo_test_static_analysis/active_record_schema/diff.rb,
lib/turbo_test_static_analysis/active_record_schema/snapshot.rb,
lib/turbo_test_static_analysis/active_record_schema/constructor.rb,
lib/turbo_test_static_analysis/active_record_schema/diff_compute.rb,
lib/turbo_test_static_analysis/active_record_schema/sexp_builder/sexp_builder.rb,
lib/turbo_test_static_analysis/active_record_schema/sexp_builder/line_column_stack.rb,
lib/turbo_test_static_analysis/active_record_schema/sexp_builder/line_stack_sexp_builder.rb

Defined Under Namespace

Classes: Constructor, Diff, DiffCompute, LineColumnStack, LineStackSexpBuilder, Map, SexpBuilder, Snapshot

Class Method Summary collapse

Class Method Details

.schema_changes(new_schema, old_schema) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/turbo_test_static_analysis/active_record_schema.rb', line 16

def schema_changes(new_schema, old_schema)
  current_snapshot = SexpBuilder.snapshot_from_source(new_schema)
  previous_snapshot = SexpBuilder.snapshot_from_source(old_schema)
  changes = DiffCompute.new(current_snapshot, previous_snapshot).calc
  {
    extensions: changes[:extensions].to_h,
    tables: changes[:tables].to_h
  }
end