You are here

function opening_hours_schema in Opening hours 7

Same name and namespace in other branches
  1. 6 opening_hours.install \opening_hours_schema()

Implements hook_schema().

File

./opening_hours.install, line 10
Database schema, installation and upgrade hooks for the opening hours module.

Code

function opening_hours_schema() {
  $schema = array();
  $schema['opening_hours'] = array(
    'description' => 'A single opening hours instance, ie. an open period on a specific date.',
    'fields' => array(
      'instance_id' => array(
        'description' => 'The primary identifier for an opening hours instance.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'nid' => array(
        'description' => 'The {node}.nid for the content this opening hours instance belongs to.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'date' => array(
        'description' => 'The date this opening hours instance is valid for.',
        'type' => 'text',
        'pgsql_type' => 'date',
        'mysql_type' => 'date',
        'not null' => TRUE,
      ),
      'start_time' => array(
        'description' => 'The time this opening hours instance starts.',
        'type' => 'text',
        'pgsql_type' => 'time',
        'mysql_type' => 'time',
        'not null' => TRUE,
      ),
      'end_time' => array(
        'description' => 'The time this opening hours instance ends.',
        'type' => 'text',
        'pgsql_type' => 'time',
        'mysql_type' => 'time',
        'not null' => TRUE,
      ),
      'category_tid' => array(
        'description' => 'The {taxonomy_term_data}.tid for the category selected for this instance, if any.',
        'type' => 'int',
        'unsigned' => TRUE,
      ),
      'notice' => array(
        'description' => 'An optional note that signifies something special about this opening hours instance',
        'type' => 'varchar',
        'length' => 255,
      ),
      'repeat_rule' => array(
        'description' => 'What repeat rule (if any) was used for this opening hours instance.',
        'type' => 'varchar',
        'length' => 255,
      ),
      'repeat_end_date' => array(
        'description' => 'The date the repeating rule ends.',
        'type' => 'text',
        'pgsql_type' => 'date',
        'mysql_type' => 'date',
      ),
      'original_instance_id' => array(
        'description' => 'The {opening_hours}.instance_id for the original instance, which this instance is a repeat of.',
        'type' => 'int',
        'unsigned' => TRUE,
      ),
      'customised' => array(
        'description' => 'Boolean indicating whether this instance has been modified, so it differs from its original instance. Not applicable (NULL) for instances that have no original instance.',
        'type' => 'int',
        'size' => 'tiny',
      ),
    ),
    'primary key' => array(
      'instance_id',
    ),
    'indexes' => array(
      'nid_date_category_tid' => array(
        'nid',
        'date',
        'category_tid',
      ),
      'original_custom' => array(
        'original_instance_id',
        'customised',
      ),
    ),
  );
  return $schema;
}