You are here

function messaging_template_schema in Messaging 6.3

Same name and namespace in other branches
  1. 6.4 messaging_template/messaging_template.install \messaging_template_schema()

Implementation of hook_schema().

File

messaging_template/messaging_template.install, line 6

Code

function messaging_template_schema() {
  $schema['messaging_template'] = array(
    'description' => 'Message templates.',
    'fields' => array(
      'tpid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Unique template id.',
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Messaging send method key.',
      ),
      'type' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Message group key.',
      ),
      'title' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Messaging send method key.',
      ),
      'description' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Destination identifier, it may be an email address.',
      ),
      'module' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Module that owns this template.',
      ),
      'fallback' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Key for template fallback.',
      ),
      'enabled' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Unix timestamp, when the message was created/stored.',
      ),
    ),
    'primary key' => array(
      'tpid',
    ),
    'indexes' => array(
      'type' => array(
        'name',
      ),
    ),
  );
  $schema['messaging_template_text'] = array(
    'description' => 'Template text parts for message composition.',
    'fields' => array(
      'tptid' => array(
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Unique template text id.',
      ),
      'name' => array(
        'type' => 'varchar',
        'length' => 100,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Message group key.',
      ),
      'method' => array(
        'type' => 'varchar',
        'length' => 50,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Messaging send method.',
      ),
      'msgkey' => array(
        'type' => 'varchar',
        'length' => 50,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Message part key, should be unique within a group (header, footer,..).',
      ),
      'language' => array(
        'type' => 'varchar',
        'length' => 12,
        'not null' => TRUE,
        'default' => '',
      ),
      'template' => array(
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'big',
        'description' => 'Message template, multiline text with tokens for replacement.',
      ),
      'options' => array(
        'description' => 'Whether the template is overridden, default, fallback.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 1,
      ),
      'format' => array(
        'description' => "The input format used by this text.",
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'tptid',
    ),
    'indexes' => array(
      'name_method_key_lang' => array(
        'name',
        'method',
        'msgkey',
        'language',
      ),
      'name' => array(
        'name',
      ),
      'method' => array(
        'method',
      ),
    ),
  );
  return $schema;
}