aboutsummaryrefslogtreecommitdiff
path: root/muamba.install
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2011-10-07 17:01:22 -0300
committerSilvio Rhatto <rhatto@riseup.net>2011-10-07 17:01:22 -0300
commiteccd915b23e2ea7a1485ecceae9e89ecc2e5c3f7 (patch)
treeede7023eb76bcbb8b3ba45e3ef840a1e3dd19b43 /muamba.install
parentf8da1aa6b4c77e839fde883e2aef244b4fe18bf8 (diff)
downloadmuamba-eccd915b23e2ea7a1485ecceae9e89ecc2e5c3f7.tar.gz
muamba-eccd915b23e2ea7a1485ecceae9e89ecc2e5c3f7.tar.bz2
Adding active, created and changed db fields
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,
+ )
+ );
+}