You are here

merci_hours.install in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.3

File

merci_hours/merci_hours.install
View source
<?php

/**
 * Implements hook_schema().
 */
function merci_hours_schema() {
  $schema = array();
  $schema['merci_hours'] = array(
    'description' => 'Stores merci hours.',
    'fields' => array(
      'id' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Primary Key: Unique work calendar ID.',
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The machine name of this work calendar.',
      ),
      'label' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The label of this work calendar.',
      ),
      'description' => array(
        'type' => 'text',
        'not null' => FALSE,
        'size' => 'medium',
        'description' => 'A brief description of this work calendar.',
      ),
    ) + entity_exportable_schema_fields(),
    'primary key' => array(
      'id',
    ),
    'unique keys' => array(
      'name' => array(
        'name',
      ),
    ),
  );
  return $schema;
}

/**
 * Implements hook_uninstall().
 */
function merci_hours_uninstall() {
  variable_del('merci_hours_default');

  // Delete any field instance attached to a line item type.
  merci_core_delete_instances('merci_hours');
}

/**
 * Implements hook_enable().
 */
function merci_hours_enable() {
  $fields = merci_hours_merci_fields_info();
  merci_core_create_field($fields[MERCI_HOURS_FIELD], 'merci_hours', 'merci_hours');
}

Functions