function notifications_schema in Notifications 6.2
Same name and namespace in other branches
- 6.4 notifications.install \notifications_schema()
- 6 notifications.install \notifications_schema()
- 6.3 notifications.install \notifications_schema()
- 7 notifications.install \notifications_schema()
Implementation of hook_schema()
File
- ./
notifications.install, line 6
Code
function notifications_schema() {
$schema['notifications'] = array(
'description' => 'The base table for subscriptions',
'fields' => array(
'sid' => array(
'description' => 'Unique Subscription id',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'disp-width' => '10',
),
'uid' => array(
'description' => 'User id this subscription belongs to.',
'type' => 'int',
'not null' => TRUE,
'disp-width' => '11',
),
'type' => array(
'description' => 'Subscription type, will depend on subscription modules enabled.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'event_type' => array(
'description' => 'Type of event that triggers this subscription.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'conditions' => array(
'description' => 'Number of conditions this subscription has, for query convenience.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'disp-width' => '10',
),
'send_interval' => array(
'description' => 'Sending interval for notifications of this subscription.',
'type' => 'int',
'not null' => FALSE,
'disp-width' => '11',
),
'send_method' => array(
'description' => 'Sending method key, see Messaging module.',
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
),
'cron' => array(
'description' => '1 if this subscription will generate notifications to be processed on cron.',
'type' => 'int',
'unsigned' => TRUE,
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'disp-width' => '3',
),
'module' => array(
'description' => 'Alternate module name to handle notifications from this subscription',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'status' => array(
'description' => 'Subscription status: 0 = blocked, 1 = active, 2 = inactive',
'type' => 'int',
'not null' => TRUE,
'default' => 1,
'disp-width' => '11',
),
'destination' => array(
'description' => 'Alternate destination field for anonymous subscriptions, may be an email',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
),
'primary key' => array(
'sid',
),
);
$schema['notifications_fields'] = array(
'description' => 'Conditions for subscriptions, there may be none or many for each subscription.',
'fields' => array(
'sid' => array(
'description' => 'The {notifications}.sid, subscription this condition belongs to.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'disp-width' => '10',
),
'field' => array(
'description' => 'The field type for this condition, will depend on subscription type and defined fields.',
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
),
'value' => array(
'description' => 'Matching value for the field, just for string values',
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
),
'intval' => array(
'description' => 'Matching value for the field, just for integer values',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'disp-width' => '11',
),
),
'primary key' => array(
'sid',
'field',
),
);
$schema['notifications_event'] = array(
'description' => 'Storage table for event parameters.',
'fields' => array(
'eid' => array(
'description' => 'Unique event id',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'disp-width' => '11',
),
'module' => array(
'description' => 'Module producing the event',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'type' => array(
'description' => 'Event type: node, feed, etc..',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'action' => array(
'description' => 'Event action: insert, update, etc.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'oid' => array(
'description' => 'Object id of the primary object for the event. I.e. for node events it will be nid',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'disp-width' => '11',
),
'language' => array(
'description' => 'Language, currently unused.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'uid' => array(
'description' => 'Id of the user causing the event.',
'type' => 'int',
'not null' => FALSE,
'disp-width' => '11',
),
'params' => array(
'description' => 'Serialized event parameters.',
'type' => 'text',
'not null' => FALSE,
'serialize' => TRUE,
),
'created' => array(
'description' => 'Unix timestamp, when it was created.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'disp-width' => '11',
),
'counter' => array(
'description' => 'Keeps a count of the notifications queued for this event.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'disp-width' => '11',
),
),
'primary key' => array(
'eid',
),
);
$schema['notifications_queue'] = array(
'description' => 'Table to store notifications produced by subscriptions, to be processed on cron.',
'fields' => array(
'sqid' => array(
'description' => 'Unique row id',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'disp-width' => '10',
),
'eid' => array(
'description' => 'The {notifications_event}.eid of the Event producing this notification.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'disp-width' => '11',
),
'sid' => array(
'description' => 'The {notifications}.sid of the Subscription producing this notification.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'disp-width' => '11',
),
'uid' => array(
'description' => 'The {user}.uid of the user this notification is for.',
'type' => 'int',
'not null' => FALSE,
'disp-width' => '11',
),
'language' => array(
'description' => 'Language, currently unused.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'type' => array(
'description' => 'The {notifications}.type of the Subscription producing this notification.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'send_interval' => array(
'description' => 'Send interval for digesting notifications.',
'type' => 'int',
'not null' => FALSE,
'disp-width' => '11',
),
'send_method' => array(
'description' => 'Messaging send method',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'sent' => array(
'description' => 'Unix timestamp, when this notification was actually sent for rows kept as logs.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'disp-width' => '10',
),
'created' => array(
'description' => 'Unix timestamp, when this notification was created.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'disp-width' => '10',
),
'cron' => array(
'description' => 'Will be 1 for rows to be processed on cron.',
'type' => 'int',
'unsigned' => TRUE,
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
'disp-width' => '3',
),
'conditions' => array(
'description' => 'The {notifications}.conditions counter, just for query convenience.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'disp-width' => '10',
),
'module' => array(
'description' => 'Optional module to process this notification.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'destination' => array(
'description' => 'Optional destination for anonymous subscriptions.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
),
'primary key' => array(
'sqid',
),
);
$schema['notifications_sent'] = array(
'description' => 'Keeps track of when the last notification was sent for a user, method, interval.',
'fields' => array(
'uid' => array(
'description' => 'The {user}.uid this row belongs to.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'disp-width' => '11',
),
'send_interval' => array(
'description' => 'The Notifications send interval.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'disp-width' => '10',
),
'send_method' => array(
'description' => 'The Messaging sending method.',
'type' => 'varchar',
'length' => '50',
'not null' => TRUE,
),
'sent' => array(
'description' => 'Unix timestamp, when the last notification was sent.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'disp-width' => '10',
),
),
'primary key' => array(
'uid',
'send_interval',
'send_method',
),
);
return $schema;
}