Class: Annotato::IndexFormatter
- Inherits:
-
Object
- Object
- Annotato::IndexFormatter
- Extended by:
- WrapHelper
- Defined in:
- lib/annotato/index_formatter.rb
Constant Summary
Constants included from WrapHelper
Class Method Summary collapse
Methods included from WrapHelper
Class Method Details
.format(conn, table_name) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/annotato/index_formatter.rb', line 7 def self.format(conn, table_name) conn.indexes(table_name).map do |idx| cols_list = Array(idx.columns).join(',') unique_clause = idx.unique ? " unique" : "" where_clause = "" if idx.where where_clause = "\n" + wrap_sql(idx.where, first_prefix: "# where (", cont_prefix: "# ") end "# #{idx.name} (#{cols_list})#{unique_clause}#{where_clause}" end end |