You are here

edit_limit.install in Edit Limit 6

Same filename and directory in other branches
  1. 7 edit_limit.install

edit_limit.install Set up the database tables for Edit Limit.

File

edit_limit.install
View source
<?php

/**
 * @file edit_limit.install
 * Set up the database tables for Edit Limit.
 */

/**
 * Implementation of hook_schema().
 */
function edit_limit_schema() {
  $schema['edit_limit_node_count'] = array(
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('node id for the rating'),
      ),
      'count' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('number of times this node has been edited'),
      ),
    ),
    'primary key' => array(
      'nid',
    ),
  );
  $schema['edit_limit_comment_count'] = array(
    'fields' => array(
      'cid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('comment id for the rating'),
      ),
      'count' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('number of times this comment has been edited'),
      ),
    ),
    'primary key' => array(
      'cid',
    ),
  );
  $schema['edit_limit_node_time'] = array(
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('node id to be edit-limited'),
      ),
      'time' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('number of seconds since initial publication this node can be edited'),
      ),
      'published' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('time of initial publication of this node'),
      ),
    ),
    'primary key' => array(
      'nid',
    ),
  );
  $schema['edit_limit_comment_time'] = array(
    'fields' => array(
      'cid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('comment id to be edit-limited'),
      ),
      'time' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('number of seconds since initial publication this node can be edited'),
      ),
      'published' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('time of initial publication of this node'),
      ),
    ),
    'primary key' => array(
      'cid',
    ),
  );
  return $schema;
}

/**
 * Implementation of hook_install().
 */
function edit_limit_install() {
  drupal_install_schema('edit_limit');
}

/**
 * Implementation of hook_uninstall().
 */
function edit_limit_uninstall() {
  db_query("DELETE FROM {variable} WHERE name LIKE 'edit_limit_%'");
  drupal_uninstall_schema('edit_limit');
}

Functions

Namesort descending Description
edit_limit_install Implementation of hook_install().
edit_limit_schema Implementation of hook_schema().
edit_limit_uninstall Implementation of hook_uninstall().