class DBPurger::Table

DBPurger::Table is an entity to keep track of basic table data

Constants

DEFAULT_BATCH_SIZE

Attributes

batch_size[RW]
conditions[RW]
field[R]
foreign_key[RW]
mark_deleted_field[RW]
mark_deleted_value[W]
name[R]
search_proc[RW]

Public Class Methods

new(name, field) click to toggle source
# File lib/db-purger/table.rb, line 19
def initialize(name, field)
  @name = name
  @field = field
  @batch_size = DEFAULT_BATCH_SIZE
end

Public Instance Methods

fields() click to toggle source
# File lib/db-purger/table.rb, line 43
def fields
  [@field] + foreign_keys
end
foreign_keys() click to toggle source
# File lib/db-purger/table.rb, line 39
def foreign_keys
  @nested_plan ? @nested_plan.foreign_tables.map(&:foreign_key).compact : []
end
mark_deleted_value() click to toggle source
# File lib/db-purger/table.rb, line 47
def mark_deleted_value
  @mark_deleted_value || 1
end
nested_plan(&block) click to toggle source
# File lib/db-purger/table.rb, line 25
def nested_plan(&block)
  @nested_plan ||= Plan.new
  PlanBuilder.new(@nested_plan).build_nested_plan(self, &block) if block
  @nested_plan
end
nested_tables?() click to toggle source
# File lib/db-purger/table.rb, line 31
def nested_tables?
  @nested_plan != nil
end
tables() click to toggle source
# File lib/db-purger/table.rb, line 35
def tables
  @nested_plan ? @nested_plan.tables : []
end