View source
<?php
function mailchimp_activity_schema() {
$schema['mailchimp_activity_entity'] = array(
'description' => 'MailChimp activity enabled entities.',
'fields' => array(
'mailchimp_activity_entity_id' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique mailchimp_activity_entity entity ID.',
),
'name' => array(
'description' => 'The machine-readable name of this mailchimp_activity_entity.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
),
'label' => array(
'description' => 'The human-readable name of this mailchimp_activity_entity.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
),
'entity_type' => array(
'description' => 'The Drupal entity type (e.g. "node", "user").',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'bundle' => array(
'description' => 'The Drupal bundle (e.g. "page", "user")',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'entity_path' => array(
'description' => 'The path to view individual entities of the selected type.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'email_property' => array(
'description' => 'The property that contains the email address to track',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'enabled' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
'description' => 'Whether or not this mailchimp activity stream is enabled.',
),
'locked' => array(
'description' => 'A boolean indicating whether the administrator may delete this mapping.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
),
'status' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0x1,
'size' => 'tiny',
'description' => 'The exportable status of the entity.',
),
'module' => array(
'description' => 'The name of the providing module if the entity has been defined in code.',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
),
),
'primary key' => array(
'mailchimp_activity_entity_id',
),
'unique keys' => array(
'name' => array(
'name',
),
'entity_type_bundle' => array(
'entity_type',
'bundle',
),
),
);
return $schema;
}
function mailchimp_activity_update_7000() {
$schema = mailchimp_activity_schema();
$field_name = 'entity_path';
$table_name = 'mailchimp_activity_entity';
$spec = $schema[$table_name]['fields'][$field_name];
db_add_field($table_name, $field_name, $spec);
}