Class: PGExaminer::Result::Table
- Inherits:
-
Item
- Object
- Base
- Item
- PGExaminer::Result::Table
show all
- Defined in:
- lib/pg_examiner/result/table.rb
Instance Attribute Summary
Attributes inherited from Item
#parent, #result, #row
Instance Method Summary
collapse
Methods inherited from Item
#initialize, #inspect, #name, #oid
Methods inherited from Base
#==, #diff, #diffable_methods
Instance Method Details
#columns ⇒ Object
23
24
25
26
27
|
# File 'lib/pg_examiner/result/table.rb', line 23
def columns
@columns ||= result.pg_attribute.select do |c|
c['attrelid'] == oid
end.sort_by{|c| c['name']}.map { |row| Column.new(result, row, self) }
end
|
#constraints ⇒ Object
35
36
37
38
39
|
# File 'lib/pg_examiner/result/table.rb', line 35
def constraints
@constraints ||= result.pg_constraint.select do |c|
c['conrelid'] == oid
end.map{|row| Constraint.new(result, row, self)}.sort_by(&:name)
end
|
#diffable_attrs ⇒ Object
15
16
17
18
19
20
21
|
# File 'lib/pg_examiner/result/table.rb', line 15
def diffable_attrs
{
"name" => "name",
"relpersistence" => "table type (relpersistence)",
"reloptions" => "table options",
}
end
|
#diffable_lists ⇒ Object
6
7
8
9
10
11
12
13
|
# File 'lib/pg_examiner/result/table.rb', line 6
def diffable_lists
{
"columns" => "columns",
"indexes" => "indexes",
"constraints" => "constraints",
"triggers" => "triggers",
}
end
|
#indexes ⇒ Object
29
30
31
32
33
|
# File 'lib/pg_examiner/result/table.rb', line 29
def indexes
@indexes ||= result.pg_index.select do |c|
c['indrelid'] == oid
end.map{|row| Index.new(result, row, self)}.sort_by(&:name)
end
|
#triggers ⇒ Object
41
42
43
44
45
|
# File 'lib/pg_examiner/result/table.rb', line 41
def triggers
@triggers ||= result.pg_trigger.select do |t|
t['tgrelid'] == oid
end.map{|row| Trigger.new(result, row, self)}.sort_by(&:name)
end
|