function activity_schema in Activity 7
Same name and namespace in other branches
- 8 activity.install \activity_schema()
- 6.2 activity.install \activity_schema()
- 6 activity.install \activity_schema()
Implementation of hook_schema().
File
- ./
activity.install, line 15
Code
function activity_schema() {
$schema['activity'] = array(
'description' => 'Provides a place to record activity messages for display.',
'fields' => array(
'aid' => array(
'description' => 'The primary identifier for any activity',
'type' => 'serial',
'not null' => TRUE,
'unsigned' => TRUE,
),
'uid' => array(
'description' => 'The user id of whomever performed the activity being recorded.',
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
),
'type' => array(
'description' => 'The hook that created this activity.',
'type' => 'varchar',
'length' => '50',
'not null' => TRUE,
),
'nid' => array(
'description' => 'A foreign key used with node_access table. Can be NULL for all non-node, comment activities',
'type' => 'int',
'unsigned' => TRUE,
),
'eid' => array(
'description' => 'Entity ID used to maintain the relationship between activity and the entity that created the activity',
'type' => 'int',
'default value' => NULL,
'unsigned' => TRUE,
),
'created' => array(
'description' => 'When the activity was recorded',
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
),
'actions_id' => array(
'description' => 'Id of the action stored in the actions table.',
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
),
'argument1' => array(
'description' => 'Serialized value of first argument passed to the actions callback',
'type' => 'text',
'size' => 'big',
'default' => NULL,
),
'argument2' => array(
'description' => 'Serialized value of second argument passed to the actions callback',
'type' => 'text',
'size' => 'big',
'default' => NULL,
),
'status' => array(
'description' => 'Whether or not this Activity is published',
'type' => 'int',
'size' => 'tiny',
'default' => 1,
),
),
'primary key' => array(
'aid',
),
'indexes' => array(
'nid' => array(
'nid',
),
'eid' => array(
'eid',
),
'created' => array(
'created',
),
),
'foreign keys' => array(
'nid' => array(
'node' => 'nid',
),
'actions_id' => array(
'actions' => 'aid',
),
'uid' => array(
'user' => 'uid',
),
),
);
$schema['activity_targets'] = array(
'fields' => array(
'aid' => array(
'description' => 'Foreign key to the activity table',
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
),
'uid' => array(
'description' => "The uid for which this message is for",
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
'default' => 0,
),
'amid' => array(
'description' => "The message id for this uid/aid combination",
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
'default' => 0,
),
'language' => array(
'description' => "The IS0-3166 name of the langauge for the associated message.",
'type' => 'varchar',
'not null' => TRUE,
'length' => '12',
),
),
'primary key' => array(
'aid',
'uid',
'language',
),
'unique keys' => array(
'amid' => array(
'amid',
),
),
'foreign keys' => array(
'aid' => array(
'activity' => 'aid',
),
'uid' => array(
'user' => 'uid',
),
'amid' => array(
'activity_messages' => 'amid',
),
),
);
$schema['activity_messages'] = array(
'fields' => array(
'amid' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The Unique id of the message',
),
'message' => array(
'descripiton' => 'The full plaintext message',
'type' => 'text',
'size' => 'big',
'not null' => TRUE,
),
),
'primary key' => array(
'amid',
),
);
$schema['activity_access'] = array(
'description' => 'Provides access control on a very granular level to activity items',
'fields' => array(
'aid' => array(
'description' => 'The primary identifier for an activity',
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
),
'realm' => array(
'description' => 'The module providing the access control',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'value' => array(
'description' => 'The provided value from the implementing module. E.g a uid, nid or a tid',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'unsigned' => TRUE,
),
),
// UGG!!!
'primary key' => array(
'aid',
'realm',
'value',
),
'foreign keys' => array(
'aid' => array(
'activity' => 'aid',
),
),
);
return $schema;
}