Class: Migflow::Analyzers::Rules::MissingTimestampsRule

Inherits:
BaseRule
  • Object
show all
Defined in:
lib/migflow/analyzers/rules/missing_timestamps_rule.rb

Constant Summary collapse

TIMESTAMP_COLUMNS =
%w[created_at updated_at].freeze
MAX_JOIN_TABLE_COLUMNS =
3

Instance Method Summary collapse

Instance Method Details

#call(tables) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/migflow/analyzers/rules/missing_timestamps_rule.rb', line 10

def call(tables)
  tables.reject { |_, table| join_table?(table) }.filter_map do |table_name, table|
    next if has_timestamps?(table)

    warning(
      table: table_name,
      message: "Table '#{table_name}' is missing created_at and/or updated_at",
      severity: :warning
    )
  end
end