]> gitweb.fluxo.info Git - drupal/muamba.git/commitdiff
Making nid and uid foreign keys at muamba table
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 23 Sep 2011 16:16:44 +0000 (13:16 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 23 Sep 2011 16:16:44 +0000 (13:16 -0300)
muamba.install

index 14debbe3e430884c9076d2d4a6aa7257da89cc81..6e68603598d2413abda7fdcfefe95d307e560085 100644 (file)
@@ -12,25 +12,30 @@ function muamba_schema() {
   $schema['muamba'] = array(
     'description' => 'The base table for muamba assets.',
     'fields'      => array(
-      'uid'       => array(
-        'description' => t('The {user}.uid requesting an item.'),
+      'nid'       => array(
+        'description' => t('The {node}.nid of the borrowed item.'),
         'type'        => 'int',
         'unsigned'    => TRUE,
         'not null'    => TRUE,
         'default'     => 0,
       ),
-      'nid'       => array(
-        'description' => t('The {node}.nid of the borrowed item.'),
+      'uid'       => array(
+        'description' => t('The {user}.uid requesting an item.'),
         'type'        => 'int',
         'unsigned'    => TRUE,
         'not null'    => TRUE,
         'default'     => 0,
       ),
     ),
-    'primary key' => array('uid', 'nid'),
-    'indexes'     => array(
-      'nid' => array('nid'),
-      'uid' => array('uid'),
+    'foreign keys' => array(
+      'node' => array(
+        'table'   => 'node',
+        'columns' => array('nid' => 'nid'),
+      ),
+      'requester' => array(
+        'table'   => 'users',
+        'columns' => array('uid' => 'uid'),
+      ),
     ),
   );