Skip to content

Comment Table Reference

mikert edited this page Feb 16, 2011 · 1 revision

Comment Table Reference

Associated Perl classes

  • MT::Comment

Fields

  • comment_id - integer not null auto_increment. - The comment table primary key.
  • comment_blog_id - integer not null. - The blog associated with this comment.
  • comment_entry_id - integer not null. - The entry associated with this comment.
  • comment_author - string(100). - The name of the person who left the comment.
  • comment_commenter_id - integer. - A pointer to the author table if the commenter was an authenticated user.
  • comment_created_by - integer. - The user who created the comment (if relevant, this is part of the "audit" option. Do not confuse it with commenter_id)
  • comment_created_on - datetime. - The date and time when the comment was created.
  • comment_visible - boolean. - A flag which controls whether or not the comment will be displayed.
  • comment_junk_status - smallint. - A flag which controls whether or not this is considered to be spam. Values are:
    • 1 - Not spam.
    • -1 - Spam.
  • comment_email - string(127). - The email address of the commenter if the commenter was not an authenticated user.
  • comment_modified_by - integer - The user who last modified this comment.
  • comment_modified_on - datetime - The date and time when the comment was last modified.
  • comment_url - string(255). - The url of the commenter if the commenter was not an authenticated user.
  • comment_text - text. - The main body of the comment.
  • comment_ip - string(50). - The IP address of the individual who left the comment.
  • comment_last_moved_on - datetime not null. - The date and time when the comment's junk status was changed.
  • comment_junk_score - float. - The combined score assigned to this comment by the spam filters. Positive values mean that it won't be considered spam. Negative mean that it is spam or spammy.
  • comment_junk_log - text. - A holding area for the spam filters to leave comments explaining why a comment was considered spam.
  • comment_parent_id - integer. - The ID of the comment to which this comment is a reply.

Indexes

  • mt_comment_entry_visible - columns:
    • entry_id
    • visible created_on
  • mt_comment_author
  • mt_comment_email
  • mt_comment_commenter_id
  • mt_comment_last_moved_on
  • mt_comment_blog_url - columns:
    • blog_id
    • visible
    • url
  • mt_comment_blog_stat - columns:
    • blog_id
    • junk_status
    • created_on
  • `mt_comment_blog_visible - columns:
    • blog_id
    • visible
    • created_on
    • id
  • `mt_comment_dd_coment_vis_mod - columns:
    • visible
    • modified_on
  • mt_comment_visible_date - columns:
    • visible
    • created_on
  • mt_comment_blog_ip_date - columns:
    • blog_id
    • ip
    • created_on

SQL Example

SELECT
    comment_author,
    comment_url,
    comment_email,
    comment_text
FROM
    mt_comment com
WHERE
    com.comment_entry_id
IN
    ( SELECT
           entry_id
      FROM
           mt_entry
      WHERE
           entry_title
      LIKE
           '%Melody%'
    )

MT::Comment/MT::Entry Example

my @entries = MT->model('entry')->load({
                                    blog_id => 1,
                                    title => { like => '%Melody%'
                                 }, {fetchonly => ['id'] });
my @eids = map { $_->id } @entries;
my @comments = MT->model('comment')->load({ entry_id => \@eids },
                                          { fetchonly => ['author', 'email', 'url', 'text'] }
                                         );
Clone this wiki locally