Class: DBA::Diff

Inherits:
Command show all
Defined in:
lib/dba/diff.rb

Instance Attribute Summary

Attributes inherited from Command

#database, #table_name

Instance Method Summary collapse

Methods inherited from Command

arity_check, #initialize

Constructor Details

This class inherits a constructor from DBA::Command

Instance Method Details

#call(url) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/dba/diff.rb', line 4

def call(url)
  other_database = Sequel.connect(url)

  tables = database.tables

  other_tables = other_database.tables

  printer.print_diff tables, other_tables

  tables &= other_tables # only diff columns/indexes for tables that exist in both databases

  printer.print_diff list_columns(database, tables), list_columns(other_database, tables)

  printer.print_diff list_indexes(database, tables), list_indexes(other_database, tables)
end