You are here

regcode.install in Registration codes 8

Install, uninstall and scheme functions for the regcode module.

File

regcode.install
View source
<?php

/**
 * @file
 * Install, uninstall and scheme functions for the regcode module.
 */

/**
 * Implements hook_schema().
 */
function regcode_schema() {

  // Definition for the regcode table.
  $schema['regcode'] = [
    'description' => 'Hold registration codes',
    'fields' => [
      'rid' => [
        'description' => 'RID',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ],
      'uid' => [
        'description' => 'User ID',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
      ],
      'created' => [
        'description' => 'Code creation time',
        'type' => 'int',
        'not null' => FALSE,
      ],
      'lastused' => [
        'description' => 'Code last used time',
        'type' => 'int',
        'not null' => FALSE,
      ],
      'begins' => [
        'description' => 'Code activation date',
        'type' => 'int',
        'not null' => FALSE,
      ],
      'expires' => [
        'description' => 'Code expiry date',
        'type' => 'int',
        'not null' => FALSE,
      ],
      'code' => [
        'description' => 'The registration code',
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
      ],
      'is_active' => [
        'description' => 'Whether the code is active',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 1,
      ],
      'maxuses' => [
        'description' => 'Maximum times a code can be used',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 1,
      ],
      'uses' => [
        'description' => 'Number of times the code has been used',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
    ],
    'primary key' => [
      'rid',
    ],
    'unique keys' => [
      'code' => [
        'code',
      ],
    ],
  ];
  return $schema;
}

Functions

Namesort descending Description
regcode_schema Implements hook_schema().