Class: Migflow::Services::TouchedTablesFromMigration

Inherits:
Object
  • Object
show all
Defined in:
lib/migflow/services/touched_tables_from_migration.rb

Constant Summary collapse

SCANNER_FIRST_COLUMN_TABLE_METHODS =
%i[
  add_columns
  remove_column
  remove_columns
  rename_columns
  change_columns
  change_column_defaults
  change_column_nulls
  change_column_comments
  add_references
  remove_references
  add_indexes
  remove_indexes
  rename_indexes
  add_foreign_keys
  remove_foreign_keys
  add_check_constraints
  remove_check_constraints
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_content:) ⇒ TouchedTablesFromMigration

Returns a new instance of TouchedTablesFromMigration.



32
33
34
# File 'lib/migflow/services/touched_tables_from_migration.rb', line 32

def initialize(raw_content:)
  @raw_content = raw_content.to_s
end

Class Method Details

.call(raw_content:) ⇒ Object



28
29
30
# File 'lib/migflow/services/touched_tables_from_migration.rb', line 28

def self.call(raw_content:)
  new(raw_content: raw_content).call
end

Instance Method Details

#callObject



36
37
38
39
40
# File 'lib/migflow/services/touched_tables_from_migration.rb', line 36

def call
  scanner = MigrationDslScanner.new(@raw_content)
  names = base_table_names(scanner) + scanner_method_table_names(scanner)
  names.map(&:to_s).reject(&:empty?).uniq
end