function party_schema in Party 7
Same name and namespace in other branches
- 8.2 party.install \party_schema()
Implements hook_schema().
File
- ./
party.install, line 36 - Contains install hooks for the CRM party module.
Code
function party_schema() {
$schema['party'] = array(
'description' => 'Stores Id, name and email for party contacts',
'fields' => array(
'pid' => array(
'description' => 'Primary key for the party.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'label' => array(
'description' => 'A label for the party. This is generated by one of a number of plugins.',
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
'default' => 'No Label Yet',
),
'archived' => array(
'description' => 'Boolean flag for whether this party should be archived.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'hidden' => array(
'description' => 'Boolean flag for whether this party should be hidden.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'merged_party' => array(
'description' => 'The pid of the party this has been merged into',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'email' => array(
'description' => 'The primary email address for this party. This is generated based off of the primary field settings.',
'type' => 'varchar',
'length' => 255,
),
),
'indexes' => array(
'archived' => array(
'archived',
),
'hidden' => array(
'hidden',
),
),
'primary key' => array(
'pid',
),
);
// Connect parties to attached entities.
$schema['party_attached_entity'] = array(
'description' => "This links parties to attached entities.",
'fields' => array(
'delta' => array(
'description' => 'The delta of this attached entity, so that every record in the table is unique',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'pid' => array(
'description' => 'The id of the party entity.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'eid' => array(
'description' => 'The id of the attached entity.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'data_set' => array(
'description' => 'The data set this entity falls under.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'entity_type' => array(
'description' => 'The type of the attached entity.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'entity_bundle' => array(
'description' => 'The bundle of the attached entity.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'hat_main' => array(
'description' => 'Is this the main set for this hat.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'hat' => array(
'description' => 'The hat this is associated with.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => 'all',
),
),
'indexes' => array(
'party' => array(
'pid',
),
'entity' => array(
'eid',
),
),
'primary key' => array(
'pid',
'data_set',
'delta',
),
);
return $schema;
}