<?php

/**
 * @file
 * Install, update and uninstall functions for the rules_link module.
 */

/**
 * Implements hook_schema().
 */
function rules_link_schema() {
  $schema['rules_link'] = array(
    'description' => 'Stores rules links.',
    'fields' => array(
      'id' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'description' => 'Primary Key: Unique id for the links.',
      ),
      'name' => array(
        'description' => 'The (machine readable) name of the link.',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
      ),
      'label' => array(
        'description' => 'The label of the link.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'path' => array(
        'type' => 'text',
        'description' => 'The path for the link.',
      ),
      'entity_type' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The entity type to which the link should be attached.',
      ),
      'settings' => array(
        'type' => 'blob',
        'size' => 'big',
        'serialize' => TRUE,
        'description' => 'Everything else, serialized.',
      ),
      'status' => array(
        'type' => 'int',
        'not null' => TRUE,
        // Set the default to ENTITY_CUSTOM without using the constant as it is
        // not safe to use it at this point.
        'default' => 0x01,
        'size' => 'tiny',
        'description' => 'The exportable status of the entity.',
      ),
      'module' => array(
        'description' => 'The name of the providing module if the entity has been defined in code.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
    ),
    'primary key' => array('id'),
    'unique keys' => array(
      'name' => array('name'),
    ),
  );
  return $schema;
}
