aboutsummaryrefslogtreecommitdiff
path: root/muamba.install
diff options
context:
space:
mode:
Diffstat (limited to 'muamba.install')
-rw-r--r--muamba.install73
1 files changed, 67 insertions, 6 deletions
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,
+ )
+ );
+}