module PgPower::ConnectionAdapters::Table::CommentMethods

Provides methods to extend ActiveRecord::ConnectionAdapters::Table to support comments feature.

Public Instance Methods

remove_column_comment(column_name) click to toggle source

Remove any comment for a given column.

Example
Remove comment from the npa column
t.remove_column_comment :npa
# File lib/pg_power/connection_adapters/table/comment_methods.rb, line 46
def remove_column_comment(column_name)
  @base.remove_column_comment(@table_name, column_name)
end
remove_column_comments(*column_names) click to toggle source

Remove any comments from the given columns.

Example
Remove comment from the npa and nxx columns
t.remove_column_comment :npa, :nxx
# File lib/pg_power/connection_adapters/table/comment_methods.rb, line 55
def remove_column_comments(*column_names)
  @base.remove_column_comments(@table_name, *column_names)
end
remove_table_comment() click to toggle source

Remove any comment from the table.

Example
Remove table comment
t.remove_table_comment
# File lib/pg_power/connection_adapters/table/comment_methods.rb, line 18
def remove_table_comment
  @base.remove_table_comment(@table_name)
end
set_column_comment(column_name, comment) click to toggle source

Set the comment for a given column.

Example
Set comment on the npa column
t.set_column_comment :npa, 'Numbering Plan Area Code - Allowed ranges: [2-9] for first digit, [0-9] for second and third digit.'
# File lib/pg_power/connection_adapters/table/comment_methods.rb, line 27
def set_column_comment(column_name, comment)
  @base.set_column_comment(@table_name, column_name, comment)
end
set_column_comments(comments) click to toggle source

Set comments on multiple columns. ‘comments’ is a hash of column_name => comment pairs.

Example
Setting comments on the columns of the phone_numbers table
t.set_column_comments :npa => 'Numbering Plan Area Code - Allowed ranges: [2-9] for first digit, [0-9] for second and third digit.',
                      :nxx => 'Central Office Number'
# File lib/pg_power/connection_adapters/table/comment_methods.rb, line 37
def set_column_comments(comments)
  @base.set_column_comments(@table_name, comments)
end
set_table_comment(comment) click to toggle source

Set the comment on the table.

Example
Set comment on table
t.set_table_comment 'This table stores phone numbers that conform to the North American Numbering Plan.'
# File lib/pg_power/connection_adapters/table/comment_methods.rb, line 9
def set_table_comment(comment)
  @base.set_table_comment(@table_name, comment)
end