| 1 |
<?php |
<?php |
| 2 |
// $Id: buddylist_api.install,v 1.1.2.1 2008/07/21 14:02:11 nodestroy Exp $ |
// $Id: buddylist_api.install,v 1.1.2.2 2008/07/25 16:49:10 nodestroy Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 15 |
* |
* |
| 16 |
* state field: |
* state field: |
| 17 |
* 0: pending (userA requests to add userB) |
* 0: pending (userA requests to add userB) |
| 18 |
* 1: accepted (userB accepts pending request from userA) |
* 1: accepted (userB accepted pending request from userA) |
| 19 |
*/ |
*/ |
| 20 |
$schema['buddylist_relations'] = array( |
$schema['buddylist_relations'] = array( |
| 21 |
'description' => t('Table for buddy relations.'), |
'description' => t('Table for buddy relations.'), |
| 22 |
'fields' => array( |
'fields' => array( |
| 23 |
'rid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE), |
'rid' => array( |
| 24 |
'requester_id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE), |
'description' => t('Numbers relations. When we have a two way relation, two rows will have the same rid.'), |
| 25 |
'requestee_id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE), |
'type' => 'int', |
| 26 |
'rtid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE), |
'unsigned' => TRUE, |
| 27 |
'state' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE), |
'not null' => TRUE), |
| 28 |
'message' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), |
'requester_id' => array( |
| 29 |
'create_time' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE), |
'description' => t('User ID of requester.'), |
| 30 |
'update_time' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE), |
'type' => 'int', |
| 31 |
|
'unsigned' => TRUE, |
| 32 |
|
'not null' => TRUE), |
| 33 |
|
'requestee_id' => array( |
| 34 |
|
'description' => t('User ID of requestee.'), |
| 35 |
|
'type' => 'int', |
| 36 |
|
'unsigned' => TRUE, |
| 37 |
|
'not null' => TRUE), |
| 38 |
|
'rtid' => array( |
| 39 |
|
'description' => t('Foreign key to relationships table.'), |
| 40 |
|
'type' => 'int', |
| 41 |
|
'unsigned' => TRUE, |
| 42 |
|
'not null' => TRUE), |
| 43 |
|
'state' => array( |
| 44 |
|
'description' => t('0 or 1, 1 means active, 0 means pending.'), |
| 45 |
|
'type' => 'int', |
| 46 |
|
'unsigned' => TRUE, |
| 47 |
|
'not null' => TRUE), |
| 48 |
|
'message' => array( |
| 49 |
|
'description' => t('Message which was send by the requester.'), |
| 50 |
|
'type' => 'varchar', |
| 51 |
|
'length' => 255, |
| 52 |
|
'not null' => TRUE, |
| 53 |
|
'default' => ''), |
| 54 |
|
'create_time' => array( |
| 55 |
|
'description' => t('Generation time of relationship.'), |
| 56 |
|
'type' => 'int', |
| 57 |
|
'unsigned' => TRUE, |
| 58 |
|
'not null' => TRUE), |
| 59 |
|
'update_time' => array( |
| 60 |
|
'description' => t('Time when relationship was last updated.'), |
| 61 |
|
'type' => 'int', |
| 62 |
|
'unsigned' => TRUE, |
| 63 |
|
'not null' => TRUE), |
| 64 |
), |
), |
| 65 |
'unique keys' => array( |
'unique keys' => array( |
| 66 |
'relationship' => array('requester_id', 'requestee_id', 'rtid'), |
'relationship' => array('requester_id', 'requestee_id', 'rtid'), |
| 77 |
$schema['buddylist_relationtypes'] = array( |
$schema['buddylist_relationtypes'] = array( |
| 78 |
'description' => t('Table for pending buddy relationships.'), |
'description' => t('Table for pending buddy relationships.'), |
| 79 |
'fields' => array( |
'fields' => array( |
| 80 |
'rtid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), |
'rtid' => array( |
| 81 |
'name' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), |
'description' => t('Primary key for relationtypes.'), |
| 82 |
'oneway' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'size' => 'tiny'), |
'type' => 'serial', |
| 83 |
'type' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE), |
'unsigned' => TRUE, |
| 84 |
'active' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE), |
'not null' => TRUE), |
| 85 |
|
'name' => array( |
| 86 |
|
'description' => t('Name of the relationship.'), |
| 87 |
|
'type' => 'varchar', |
| 88 |
|
'length' => 255, |
| 89 |
|
'not null' => TRUE, |
| 90 |
|
'default' => ''), |
| 91 |
|
'oneway' => array( |
| 92 |
|
'description' => t('0 or 1, 1 stands for oneway.'), |
| 93 |
|
'type' => 'int', |
| 94 |
|
'unsigned' => TRUE, |
| 95 |
|
'not null' => TRUE, |
| 96 |
|
'default' => 0, |
| 97 |
|
'size' => 'tiny'), |
| 98 |
|
'type' => array( |
| 99 |
|
'description' => t('0 or 1, 1 means user generated, rows with 0 are from contrib modules.'), |
| 100 |
|
'type' => 'int', |
| 101 |
|
'unsigned' => TRUE, |
| 102 |
|
'not null' => TRUE), |
| 103 |
|
'active' => array( |
| 104 |
|
'description' => t('0 or 1, 1 means active'), |
| 105 |
|
'type' => 'int', |
| 106 |
|
'unsigned' => TRUE, |
| 107 |
|
'not null' => TRUE), |
| 108 |
), |
), |
| 109 |
'unique keys' => array( |
'unique keys' => array( |
| 110 |
'name' => array('name'), |
'name' => array('name'), |