You are here

node_limit_user.install in Node Limit 6

Same filename and directory in other branches
  1. 7 node_limit_user/node_limit_user.install

Installation functions for module node_limit_user.

File

node_limit_user/node_limit_user.install
View source
<?php

/**
 * @file
 * Installation functions for module node_limit_user.
 */

/**
 * Implementation of hook_install().
 */
function node_limit_user_install() {
  db_query("DROP TABLE IF EXISTS {node_limit_user}");
  drupal_install_schema('node_limit_user');
}

/**
 * Implementation of hook_schema().
 */
function node_limit_user_schema() {
  $schema['node_limit_user'] = array(
    'description' => t('The table for applying node limits to a user'),
    'fields' => array(
      'lid' => array(
        'description' => t('The {node_limit}.lid'),
        'type' => 'int',
        'not null' => TRUE,
      ),
      'uid' => array(
        'description' => t('The {user}.uid to which this limit applies'),
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
      ),
    ),
    //the limit-user combination is unique

    /**
     * this means that in the future, we may allow a limit to be applied to more
     * than one user.  right now, though, its one-user-per-limit
     */
    'primary key' => array(
      'lid',
      'uid',
    ),
  );
  return $schema;
}

/*
 * Implementation of hook_uninstall().
 */
function node_limit_user_uninstall() {
  drupal_uninstall_schema('node_limit_user');
}

Functions