You are here

function messaging_schema in Messaging 7

Same name and namespace in other branches
  1. 6.4 messaging.install \messaging_schema()
  2. 6 messaging.install \messaging_schema()
  3. 6.2 messaging.install \messaging_schema()
  4. 6.3 messaging.install \messaging_schema()

Implementation of hook_schema().

File

./messaging.install, line 6

Code

function messaging_schema() {
  $schema['messaging_message'] = array(
    'description' => 'Stores message destination for users and non users.',
    'fields' => array(
      'msid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Unique message id.',
      ),
      'method' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Messaging send method key.',
      ),
      'store' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Where the message is stored.',
      ),
      'mqid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Queue id if any.',
      ),
      'language' => array(
        'type' => 'varchar',
        'length' => 12,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Language code.',
      ),
      'status' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 1,
        'size' => 'tiny',
        'description' => 'Message status.',
      ),
      'created' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Timestamp when the item was created.',
      ),
      'updated' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Timestamp when the item was created.',
      ),
      'sent' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Unix timestamp, when the last message was sent to this address.',
      ),
      'error' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
        'description' => 'Error code if any.',
      ),
    ),
    'primary key' => array(
      'msid',
    ),
    'indexes' => array(
      'method' => array(
        'method',
      ),
    ),
  );
  $schema['messaging_destination'] = array(
    'description' => 'Stores message destination for users and non users.',
    'fields' => array(
      'mdid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Unique destination id.',
      ),
      'uid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The {user}.uid for destination if it belongs to a registered user.',
      ),
      'type' => array(
        'type' => 'varchar',
        'length' => 60,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Destination type: mail, xmpp, etc.',
      ),
      'address' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Destination identifier, it may be an email address.',
      ),
      'status' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 1,
        'size' => 'tiny',
        'description' => 'Destination status: 1= active, 0 = inactive.',
      ),
      'sent' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Unix timestamp, when the last message was sent to this address.',
      ),
    ),
    'primary key' => array(
      'mdid',
    ),
    'indexes' => array(
      'uid' => array(
        'uid',
      ),
      'address' => array(
        'address',
      ),
    ),
  );
  return $schema;
}