lib/ahnnotate/table.rb in ahnnotate-0.4.0 vs lib/ahnnotate/table.rb in ahnnotate-0.5.0
- old
+ new
@@ -1,10 +1,11 @@
module Ahnnotate
class Table
attr_accessor :name
attr_accessor :columns
attr_accessor :indexes
+ attr_accessor :foreign_keys
def initialize(**args)
args.each do |key, value|
public_send("#{key}=", value)
end
@@ -27,9 +28,16 @@
if indexes.any?
output.puts "#{comment} Indexes:"
output.puts comment
output.print tabularizer.call(indexes, [:name, :presentable_columns, :presentable_unique, :comment])
+ output.puts comment
+ end
+
+ if foreign_keys.any?
+ output.puts "#{comment} Foreign keys:"
+ output.puts comment
+ output.puts tabularizer.call(foreign_keys, [:from, :to, :name])
output.puts comment
end
output.string
end