Class RR::TableSorter
In: lib/rubyrep/table_sorter.rb
Parent: Object

This class sorts a given list of tables so that tables referencing other tables via foreign keys are placed behind those referenced tables.

Rationale: If tables are sorted in that sequence, the risk of foreign key violations is smaller.

Methods

Included Modules

TSort

Attributes

session  [RW]  The active Session
tables  [RW]  The list of table names to be ordered

Public Class methods

Initializes the TableSorter

  • session: The active Session instance
  • tables: an array of table names

Public Instance methods

The table dependencies. Format as described e. g. here: PostgreSQLExtender#referenced_tables

Yields all tables that are references by table.

Yields each table. For details see standard library: TSort#sort_each_node.

[Validate]