function crm_core_activity_schema in CRM Core 7
Implements hook_schema().
File
- modules/
crm_core_activity/ crm_core_activity.install, line 53 - Install, update, and uninstall functions for the CRM Core Activity module.
Code
function crm_core_activity_schema() {
$schema = array();
$schema['crm_core_activity'] = array(
'description' => 'The base table for activities.',
'fields' => array(
'activity_id' => array(
'description' => 'The primary identifier for an activity.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'revision_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
'default' => NULL,
'description' => 'Primary identifier of this {crm_core_activity_revision}.',
),
'uid' => array(
'description' => 'The {users}.uid that owns this activity; initially, this is the user that created it.',
'type' => 'int',
'not null' => TRUE,
),
'type' => array(
'description' => 'The type (bundle) of this activity.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'title' => array(
'description' => 'The title of the activity.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'created' => array(
'description' => 'The Unix timestamp when the activity was created.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'changed' => array(
'description' => 'The Unix timestamp when the activity was most recently saved.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'indexes' => array(
'created' => array(
'created',
),
'changed' => array(
'changed',
),
),
'foreign keys' => array(
'activity_type' => array(
'table' => 'crm_core_activity_type',
'columns' => array(
'type' => 'type',
),
),
'activity_revision' => array(
'table' => 'crm_core_activity_revision',
'columns' => array(
'revision_id' => 'revision_id',
),
),
),
'primary key' => array(
'activity_id',
),
);
$schema['crm_core_activity_revision'] = array(
'description' => 'Stores information about each saved revision of a {crm_core_activity}',
'fields' => array(
'revision_id' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary identifier of this {crm_core_activity_revision}.',
),
'activity_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
'default' => NULL,
'description' => 'The {crm_core_activity}.activity_id for this revision.',
),
'uid' => array(
'description' => 'The {users}.uid that created this version.',
'type' => 'int',
'not null' => TRUE,
),
'title' => array(
'description' => 'The title of the activity.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'created' => array(
'description' => 'The Unix timestamp when the activity was created.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'changed' => array(
'description' => 'The Unix timestamp when the activity was most recently saved.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'foreign keys' => array(
'versioned_activity' => array(
'table' => 'crm_core_activity',
'columns' => array(
'activity_id' => 'activity_id',
),
),
'version_creator' => array(
'table' => 'user',
'columns' => array(
'uid' => 'uid',
),
),
),
'primary key' => array(
'revision_id',
),
);
$schema['crm_core_activity_type'] = array(
'description' => 'Stores information about all defined activity types.',
'fields' => array(
'id' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique activity type ID.',
),
'type' => array(
'description' => 'The machine-readable name of this type.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
),
'label' => array(
'description' => 'The human-readable name of this type.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'description' => array(
'description' => 'A brief description of this type.',
'type' => 'text',
'not null' => TRUE,
'size' => 'medium',
'translatable' => TRUE,
),
'activity_string' => array(
'description' => 'Text describing the relationship between the contact and this activity.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'translatable' => TRUE,
),
) + entity_exportable_schema_fields(),
'primary key' => array(
'id',
),
'unique keys' => array(
'type' => array(
'type',
),
),
);
if (module_exists('uuid')) {
$field = uuid_schema_field_definition();
$schema['crm_core_activity']['fields']['uuid'] = $field;
$schema['crm_core_activity']['indexes']['uuid'] = array(
'uuid',
);
$schema['crm_core_activity_revision']['fields']['vuuid'] = $field;
$schema['crm_core_activity_revision']['indexes']['vuuid'] = array(
'vuuid',
);
}
return $schema;
}