module PgSaurus::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_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_saurus/connection_adapters/table/comment_methods.rb, line 55 def remove_column_comments(*column_names) @base.remove_column_comments(@name, *column_names) end
remove_table_comment()
click to toggle source
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_saurus/connection_adapters/table/comment_methods.rb, line 27 def set_column_comment(column_name, comment) @base.set_column_comment(@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_saurus/connection_adapters/table/comment_methods.rb, line 37 def set_column_comments(comments) @base.set_column_comments(@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_saurus/connection_adapters/table/comment_methods.rb, line 9 def set_table_comment(comment) @base.set_table_comment(@name, comment) end