function merci_schema in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.2
Same name and namespace in other branches
- 6.2 merci.install \merci_schema()
- 6 merci.install \merci_schema()
Implements hook_schema().
File
- ./
merci.install, line 108 - merci Installer / Uninstaller
Code
function merci_schema() {
$schema['merci_node_type'] = array(
'description' => 'Stores booking-related information that applies to content types.',
'fields' => array(
'type' => array(
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
'description' => "Foreign key for {node_type}.type.",
),
'merci_type_setting' => array(
'type' => 'varchar',
'length' => 20,
'not null' => TRUE,
'default' => 'disabled',
'description' => "The MERCI type for the selected content type.",
),
'merci_max_hours_per_reservation' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => "The maximum hours that the resource can be reserved for.",
),
'merci_allow_overnight' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'description' => "TRUE if the resource can be kept overnight.",
),
'merci_allow_weekends' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'description' => "TRUE if the resource can be kept over weekends.",
),
'merci_late_fee_per_hour' => array(
'type' => 'float',
'not null' => TRUE,
'default' => 0,
'description' => "Per hour fee if the resource is returned late.",
),
'merci_rate_per_hour' => array(
'type' => 'float',
'not null' => TRUE,
'default' => 0,
'description' => "Per hour fee for use of the resource.",
),
'merci_daypart1_price' => array(
'type' => 'float',
'not null' => TRUE,
'default' => 0,
'description' => "Fee for use of the resource between start and end of day part.",
),
'merci_daypart2_price' => array(
'type' => 'float',
'not null' => TRUE,
'default' => 0,
'description' => "Fee for use of the resource between start and end of day part.",
),
'merci_daypart3_price' => array(
'type' => 'float',
'not null' => TRUE,
'default' => 0,
'description' => "Fee for use of the resource between start and end of day part.",
),
'merci_weekend_price' => array(
'type' => 'float',
'not null' => TRUE,
'default' => 0,
'description' => "Fee for use of the resource between on day flagged as weekend.",
),
'merci_fee_free_hours' => array(
'type' => 'float',
'not null' => TRUE,
'default' => 0,
'description' => "Number of hours the item can be used before fees are charged.",
),
'merci_active_status' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => "The status of the resource.",
),
'merci_spare_items' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => "Number of spare items to leave unreserved for the resource.",
),
'merci_min_cancel_hours' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => "Minimum number of hours a user can cancel a reservation for the item.",
),
'merci_autocheckout' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'description' => "TRUE if the resource is automatically checked out when Reservation starts.",
),
'merci_autocheckin' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'description' => "TRUE if the resource is automatically checked in when Reservation starts.",
),
'merci_selfcheckout' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'description' => "TRUE if the resource is managed by selfcheckout.",
),
'merci_grouping' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
'description' => "tid of MERCI Equiment Grouping vocabulary",
),
'merci_auto_assign_bucket_item' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => FALSE,
'description' => "TRUE if the bucket item is to be assigned automatically.",
),
),
'primary key' => array(
'type',
),
);
$schema['merci_reservation'] = array(
'description' => 'Stores bookings reservations.',
'fields' => array(
'nid' => array(
'type' => 'int',
'not null' => TRUE,
'description' => "The reservations's associated nid.",
),
'vid' => array(
'type' => 'int',
'not null' => TRUE,
'description' => "The reservations's associated vid.",
),
'merci_reservation_status' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 1,
'description' => 'Finalized bookings cannot have time conflicts with each other. Finalized availabilities must be obeyed.',
),
),
'primary key' => array(
'nid',
'vid',
),
'indexes' => array(
'merci_reservation_status' => array(
'merci_reservation_status',
),
),
);
$schema['merci_reservation_detail'] = array(
'description' => 'Stores details on resources reserved.',
'fields' => array(
'did' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Unique ID for the reservation detail entry.',
),
'nid' => array(
'type' => 'int',
'not null' => TRUE,
'description' => 'Foreign key for {merci_reservation}.nid.',
),
'vid' => array(
'type' => 'int',
'not null' => TRUE,
'description' => 'Foreign key for {merci_reservation}.vid.',
),
'merci_placeholder_nid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'The nid for an associated reservation placeholder node for the reservation.',
),
'merci_item_nid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'The nid for an item node associated with the reservation placeholder node for the reservation.',
),
'merci_item_status' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'The status of the item associated in the item_nid column.',
),
),
'primary key' => array(
'did',
),
'indexes' => array(
'nids' => array(
'nid',
'vid',
'merci_placeholder_nid',
'merci_item_nid',
),
'merci_item_status' => array(
'merci_item_status',
),
),
);
$schema['merci_bucket_node'] = array(
'description' => 'Stores information on bookable bucket nodes.',
'fields' => array(
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => "The bookable resource nid.",
),
'vid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => "The bookable resource vid.",
),
'merci_default_availability' => array(
'type' => 'int',
'not null' => TRUE,
'size' => 'tiny',
'default' => 0,
'description' => 'Default availability of the resource.',
),
'merci_late_fee_per_hour' => array(
'type' => 'float',
'not null' => TRUE,
'default' => 0,
'description' => "Per hour fee if the resource is returned late.",
),
'merci_rate_per_hour' => array(
'type' => 'float',
'not null' => TRUE,
'default' => 0,
'description' => "Per hour fee for use of the resource.",
),
'merci_daypart1_price' => array(
'type' => 'float',
'not null' => TRUE,
'default' => 0,
'description' => "Fee for use of the resource between start and end of day part.",
),
'merci_daypart2_price' => array(
'type' => 'float',
'not null' => TRUE,
'default' => 0,
'description' => "Fee for use of the resource between start and end of day part.",
),
'merci_daypart3_price' => array(
'type' => 'float',
'not null' => TRUE,
'default' => 0,
'description' => "Fee for use of the resource between start and end of day part.",
),
'merci_weekend_price' => array(
'type' => 'float',
'not null' => TRUE,
'default' => 0,
'description' => "Fee for use of the resource between on day flagged as weekend.",
),
'merci_fee_free_hours' => array(
'type' => 'float',
'not null' => TRUE,
'default' => 0,
'description' => "Number of hours the item can be used before fees are charged.",
),
'merci_min_cancel_hours' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => "Minimum number of hours a user can cancel a reservation for the item.",
),
'merci_autocheckout' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'description' => "TRUE if the resource is automatically checked out when Reservation starts.",
),
'merci_autocheckin' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'description' => "TRUE if the resource is automatically checked in when Reservation starts.",
),
'merci_selfcheckout' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'description' => "TRUE if the resource is managed by selfcheckout.",
),
'merci_sub_type' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => "The subtype of bucket node, either item or reservation.",
),
),
'primary key' => array(
'nid',
'vid',
),
);
$schema['merci_resource_node'] = array(
'description' => 'Stores information on bookable resource nodes.',
'fields' => array(
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => "The bookable resource nid.",
),
'vid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => "The bookable resource vid.",
),
'merci_default_availability' => array(
'type' => 'int',
'not null' => TRUE,
'size' => 'tiny',
'default' => 0,
'description' => 'Default availability of the item .',
),
'merci_late_fee_per_hour' => array(
'type' => 'float',
'not null' => TRUE,
'default' => 0,
'description' => "Per hour fee if the resource is returned late.",
),
'merci_rate_per_hour' => array(
'type' => 'float',
'not null' => TRUE,
'default' => 0,
'description' => "Per hour fee for use of the resource.",
),
'merci_daypart1_price' => array(
'type' => 'float',
'not null' => TRUE,
'default' => 0,
'description' => "Fee for use of the resource between start and end of day part.",
),
'merci_daypart2_price' => array(
'type' => 'float',
'not null' => TRUE,
'default' => 0,
'description' => "Fee for use of the resource between start and end of day part.",
),
'merci_daypart3_price' => array(
'type' => 'float',
'not null' => TRUE,
'default' => 0,
'description' => "Fee for use of the resource between start and end of day part.",
),
'merci_weekend_price' => array(
'type' => 'float',
'not null' => TRUE,
'default' => 0,
'description' => "Fee for use of the resource between on day flagged as weekend.",
),
'merci_fee_free_hours' => array(
'type' => 'float',
'not null' => TRUE,
'default' => 0,
'description' => "Number of hours the item can be used before fees are charged.",
),
'merci_min_cancel_hours' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => "Minimum number of hours a user can cancel a reservation for the item.",
),
'merci_autocheckout' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'description' => "TRUE if the resource is automatically checked out when Reservation starts.",
),
'merci_autocheckin' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'description' => "TRUE if the resource is automatically checked in when Reservation starts.",
),
'merci_selfcheckout' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'description' => "TRUE if the resource is managed by selfcheckout.",
),
'merci_sub_type' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => "The subtype of resource node, either item or reservation.",
),
),
'primary key' => array(
'nid',
'vid',
),
);
$schema['merci_reservation_item_node'] = array(
'description' => 'Stores information on bookable resource and bucket nodes.',
'fields' => array(
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => "The bookable resource nid.",
),
'vid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => "The bookable resource vid.",
),
'merci_default_availability' => array(
'type' => 'int',
'not null' => TRUE,
'size' => 'tiny',
'default' => 0,
'description' => 'Default availability of the item .',
),
'merci_sub_type' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => "The subtype of resource node, either item or reservation.",
),
'merci_item_status' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'The status of the item associated in the item_nid column.',
),
),
'primary key' => array(
'nid',
'vid',
),
'indexes' => array(
'merci_sub_type' => array(
'merci_sub_type',
),
),
);
return $schema;
}