You are here

function editor_note_schema in Editor Notes 7

Implements hook_schema().

File

./editor_note.install, line 10
Database schema and installations tasks for Editor Notes module.

Code

function editor_note_schema() {
  $schema['editor_note'] = array(
    'description' => 'Base table for editor notes.',
    'fields' => array(
      'id' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'description' => 'Primary Key: unique note id.',
      ),
      'note' => array(
        'type' => 'text',
        'not null' => TRUE,
        'size' => 'medium',
        'description' => 'Content of the note.',
      ),
      'entity_type' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The entity type note is attached to.',
      ),
      'bundle' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The bundle of the entity note is attached to.',
      ),
      'field_name' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The {field_config}.field name of the field containing editor note.',
      ),
      'entity_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'The entity id note is attached to.',
      ),
      'revision_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
        'description' => 'The entity revision id note is attached to, or NULL if the entity type is not versioned.',
      ),
      'uid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The {users}.uid who authored the note.',
      ),
      'created' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The time that the note was created, as a Unix timestamp.',
      ),
      'changed' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The time that the note was last edited, as a Unix timestamp.',
      ),
      'text_format' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The text format of an editor note.',
      ),
    ),
    'primary key' => array(
      'id',
    ),
    'indexes' => array(
      'editor_note_id' => array(
        'id',
      ),
      'editor_note_uid' => array(
        'uid',
      ),
      'editor_note_changed' => array(
        'changed',
      ),
      'editor_note_created' => array(
        'created',
      ),
    ),
  );
  return $schema;
}