function library_schema in Library 7
Same name and namespace in other branches
- 5.2 library.install \library_schema()
- 6.2 library.install \library_schema()
- 6 library.install \library_schema()
Implements hook_schema().
File
- ./
library.install, line 14 - @author Jess Straatmann Install and uninstall all required databases.
Code
function library_schema() {
$schema['library'] = array(
'description' => 'Determines if a library item may be checked out.',
'fields' => array(
'id' => array(
'description' => 'The primary identifier for a library item.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'barcode' => array(
'description' => 'The barcode/identifier for this item.',
'type' => 'varchar',
'length' => 60,
'not null' => FALSE,
'default' => '',
),
'nid' => array(
'description' => 'The node identifier.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'in_circulation' => array(
'description' => 'Boolean indicating whether the item is in circulation.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'library_status' => array(
'description' => 'Boolean indicating whether the item is available. Not directly editable.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'notes' => array(
'description' => 'Short description field for additional comments about the item.',
'type' => 'varchar',
'length' => 256,
'not null' => FALSE,
'default' => '',
),
'created' => array(
'type' => 'int',
'description' => 'Timestamp for when the item was created.',
'not null' => TRUE,
'default' => 0,
),
),
'indexes' => array(
'nid' => array(
'nid',
),
),
'primary key' => array(
'id',
),
);
$schema['library_transactions'] = array(
'description' => 'The table where library transactions are stored.',
'fields' => array(
'tid' => array(
'description' => 'The primary identifier for a transaction.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'item_id' => array(
'description' => 'The associated library item.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'nid' => array(
'description' => 'The associated library node.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'uid' => array(
'description' => 'The associated patron user.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'action_aid' => array(
'description' => 'The action performed.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'duedate' => array(
'type' => 'int',
'description' => 'Timestamp for the current duedate.',
'not null' => FALSE,
'default' => NULL,
),
'notes' => array(
'description' => 'Short description field for additional comments about the transaction.',
'type' => 'varchar',
'length' => 256,
'not null' => FALSE,
'default' => NULL,
),
'created' => array(
'type' => 'int',
'description' => 'Timestamp for when transaction occurred.',
'not null' => TRUE,
'default' => 0,
),
),
'indexes' => array(
'item_id' => array(
'item_id',
),
'uid' => array(
'uid',
),
'action_aid' => array(
'action_aid',
),
),
'primary key' => array(
'tid',
),
);
$schema['library_actions'] = array(
'description' => 'The table where library transactions are stored.',
'fields' => array(
'aid' => array(
'description' => 'The unique identifier of this action.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'name' => array(
'description' => 'The name of this action.',
'type' => 'varchar',
'length' => 60,
'not null' => TRUE,
'default' => '',
),
'status_change' => array(
'description' => 'Indicates if the action changes item status.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'aid',
),
);
return $schema;
}