You are here

function availability_calendars_schema in Availability Calendars 6

Same name and namespace in other branches
  1. 6.2 availability_calendars.install \availability_calendars_schema()
  2. 7.2 availability_calendars.install \availability_calendars_schema()

Implements hook_schema().

File

./availability_calendars.install, line 14
Install, update and uninstall functions for the Availability Calendars module.

Code

function availability_calendars_schema() {
  $schema = array();
  $schema['availability_calendars_day'] = array(
    'description' => 'The table for calendar days.',
    'fields' => array(
      'nid' => array(
        'description' => 'The primary identifier for a node.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'year' => array(
        'description' => 'The number of the year.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'month' => array(
        'description' => 'The number of the month.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'day' => array(
        'description' => 'The number of the day.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'status' => array(
        'description' => 'The status.',
        'type' => 'text',
        'size' => 'medium',
      ),
      // [#747036]: this duplication allows for better querying
      // @todo: make this a date field instead of datetime?
      // @todo: remove year,month,day fields? what about cross-db handling (mysql, postgres, sqlite, mssql, ...)
      'date' => array(
        'description' => 'Datetime representation of availability',
        'type' => 'datetime',
      ),
    ),
  );
  $schema['availability_calendars_week'] = array(
    'description' => 'The table for calendar days.',
    'fields' => array(
      'nid' => array(
        'description' => 'The primary identifier for a node.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'year' => array(
        'description' => 'The number of the year.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'month' => array(
        'description' => 'The number of the month.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'week' => array(
        'description' => 'The number of the week.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'note' => array(
        'description' => 'The status.',
        'type' => 'varchar',
        'length' => 64,
      ),
    ),
  );
  return $schema;
}