You are here

comment_sort_created.install in Comment sort by created 7

Installation tasks for the Comment sorty by created module.

File

comment_sort_created.install
View source
<?php

/**
 * @file
 * Installation tasks for the Comment sorty by created module.
 */

/**
 * Implements hook_schema().
 */
function comment_sort_created_schema() {
  $schema = array();
  $schema['comment_sort_created'] = array(
    'description' => 'Stores details about drupal.org projects.',
    'fields' => array(
      'cid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'Primary Key: Unique comment ID.',
      ),
      'created_thread' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'description' => "Just like the 'thread' column in the comment table but using the created timestamp instead of the id for sorting.",
      ),
    ),
    'primary key' => array(
      'cid',
    ),
    'indexes' => array(
      'comment_sort_created' => array(
        'cid',
        'created_thread',
      ),
    ),
  );
  return $schema;
}

/**
 * Implements hook_uninstall().
 *
 * Removes used variables.
 */
function comment_sort_created_uninstall() {

  // Delete all (dynamically named) used variables.
  db_delete('variable')
    ->condition('name', 'comment_sort_created_%', 'LIKE')
    ->execute();
  cache_clear_all('variables', 'cache_bootstrap');
}