You are here

function merci_reservation_schema in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.3

Implements hook_schema().

File

merci_reservation/merci_reservation.install, line 13
Sets up the base table for our entity and a table to store information about the entity types.

Code

function merci_reservation_schema() {
  $schema = array();
  $schema['merci_reservation'] = array(
    'description' => 'The base table for merci_reservation entities.',
    'fields' => array(
      'id' => array(
        'description' => 'Primary Key: Identifier for a merci_reservation.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'type' => array(
        'description' => 'The {merci_reservation_type}.type of this merci_reservation.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'created' => array(
        'description' => 'The Unix timestamp when the merci_reservation was created.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'changed' => array(
        'description' => 'The Unix timestamp when the merci_reservation was most recently saved.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'uid' => array(
        'description' => 'The {users}.uid that owns this node; initially, this is the user that created it.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'data' => array(
        'type' => 'blob',
        'not null' => FALSE,
        'size' => 'big',
        'serialize' => TRUE,
        'description' => 'A serialized array of additional data.',
      ),
    ),
    'primary key' => array(
      'id',
    ),
    'indexes' => array(
      'type' => array(
        'type',
      ),
      'uid' => array(
        'uid',
      ),
    ),
    'foreign keys' => array(
      'node_author' => array(
        'table' => 'users',
        'columns' => array(
          'uid' => 'uid',
        ),
      ),
    ),
  );
  $schema['merci_reservation_type'] = array(
    'description' => 'Stores information about defined merci_reservation types.',
    'fields' => array(
      'id' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'description' => 'Primary Key: Unique merci_reservation type identifier.',
      ),
      'type' => array(
        'description' => 'The machine-readable name of this merci_reservation type.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'label' => array(
        'description' => 'The human-readable name of this merci_reservation type.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'weight' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
        'description' => 'The weight of this merci_reservation type in relation to others.',
      ),
      'data' => array(
        'type' => 'text',
        'not null' => FALSE,
        'size' => 'big',
        'serialize' => TRUE,
        'description' => 'A serialized array of additional data related to this merci_reservation type.',
      ),
    ) + entity_exportable_schema_fields(),
    'primary key' => array(
      'id',
    ),
    'unique keys' => array(
      'type' => array(
        'type',
      ),
    ),
  );
  return $schema;
}