From eccd915b23e2ea7a1485ecceae9e89ecc2e5c3f7 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 7 Oct 2011 17:01:22 -0300 Subject: Adding active, created and changed db fields --- muamba.install | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 67 insertions(+), 6 deletions(-) (limited to 'muamba.install') diff --git a/muamba.install b/muamba.install index ebd737e..2ffc573 100644 --- a/muamba.install +++ b/muamba.install @@ -18,13 +18,13 @@ function muamba_schema() { $schema['muamba'] = array( 'description' => 'The base table for muamba assets.', 'fields' => array( - 'mid' => array( + 'mid' => array( 'description' => t('The primary identifier for a muamba transaction.'), 'type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, ), - 'nid' => array( + 'nid' => array( 'description' => t('The {node}.nid of the borrowed item.'), 'type' => 'int', 'unsigned' => TRUE, @@ -33,34 +33,55 @@ function muamba_schema() { ), // This assumes that the node won't have his author changed, // which might be reasonable depending on the application. - 'owner' => array( + 'owner' => array( 'description' => t('The {user}.owner owner of an item.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), - 'uid' => array( + 'uid' => array( 'description' => t('The {user}.uid requesting an item.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), - 'thread_id' => array( + 'thread_id' => array( 'description' => t('The {thread}.thread_id for the transaction.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), - 'status' => array( + '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( @@ -160,3 +181,43 @@ function muamba_update_7002(&$sandbox) { ) ); } + +/** + * 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, + ) + ); +} -- cgit v1.2.3