'The base table for muamba assets.', 'fields' => array( 'mid' => array( 'description' => t('The primary identifier for a muamba transaction.'), 'type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, ), 'nid' => array( 'description' => t('The {node}.nid of an item.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'owner' => array( 'description' => t('The {user}.owner owner of an item.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'uid' => array( 'description' => t('The {user}.uid requesting an item.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'thread_id' => array( 'description' => t('The {thread}.thread_id for the transaction.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'status' => array( 'description' => t('Transaction status.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'active' => array( 'description' => t('Whether it is an active transaction.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 1, ), 'created' => array( 'description' => 'Timestamp of the transaction request', 'type' => 'int', 'not null' => TRUE, 'unsigned' => TRUE, 'default' => 0, ), 'changed' => array( 'description' => 'Timestamp of the latest update', 'type' => 'int', 'not null' => TRUE, 'unsigned' => TRUE, 'default' => 0, ), ), 'foreign keys' => array( 'node' => array( 'table' => 'node', 'columns' => array('nid' => 'nid'), ), 'owner' => array( 'table' => 'users', 'columns' => array('owner' => 'uid'), ), 'requester' => array( 'table' => 'users', 'columns' => array('uid' => 'uid'), ), 'thread' => array( 'table' => 'pm_index', 'columns' => array('thread_id' => 'thread_id'), ), ), 'primary key' => array('mid'), ); return $schema; } /** * Adds transactional fields to muamba data model. */ function muamba_update_7000(&$sandbox) { // Make sure to not run this update twice. if (db_field_exists('muamba', 'mid')) { return; } db_add_field('muamba', 'mid', array( 'description' => t('The primary identifier for a muamba transaction.'), 'type' => 'int', 'not null' => TRUE, ) ); db_add_primary_key('muamba', array('mid')); db_add_field('muamba', 'status', array( 'description' => t('Transaction status.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ) ); db_add_field('muamba', 'thread_id', array( 'description' => t('The {thread}.thread_id for the transaction.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), array( 'foreign keys' => array( 'thread' => array( 'table' => 'pm_index', 'columns' => array('thread_id' => 'thread_id'), ) ) ) ); } /** * Adds autoincrement to mid field. */ function muamba_update_7001(&$sandbox) { db_change_field('muamba', 'mid', 'mid', array( 'type' => 'serial', 'not null' => TRUE, ) ); } /** * Adds owner field. */ function muamba_update_7002(&$sandbox) { db_add_field('muamba', 'owner', array( 'description' => t('The {user}.owner owner of an item.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ) ); } /** * Adds active field. */ function muamba_update_7003(&$sandbox) { db_add_field('muamba', 'active', array( 'description' => t('Whether it is an active transaction.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 1, ) ); } /** * Adds timestamp fields. */ function muamba_update_7004(&$sandbox) { db_add_field('muamba', 'created', array( 'description' => 'Timestamp of the transaction request', 'type' => 'int', 'not null' => TRUE, 'unsigned' => TRUE, 'default' => 0, ) ); db_add_field('muamba', 'changed', array( 'description' => 'Timestamp of the latest update', 'type' => 'int', 'not null' => TRUE, 'unsigned' => TRUE, 'default' => 0, ) ); }