diff mee.install @ 14:50a57b1517cb

Fully working MEE, with Ressource Manager & all
author Franck Deroche <franck@defr.org>
date Fri, 18 Sep 2009 15:18:53 +0200
parents 548f63d8a41b
children 7bb375e191b1
line wrap: on
line diff
--- a/mee.install	Mon Jun 08 18:33:19 2009 +0200
+++ b/mee.install	Fri Sep 18 15:18:53 2009 +0200
@@ -8,6 +8,7 @@
  function mee_install() {
    drupal_load('module', 'content');
    content_notify('install', 'mee');
+   drupal_install_schema('mee');  
  }
 
 /**
@@ -16,6 +17,7 @@
  function mee_uninstall() {
    drupal_load('module', 'content');
    content_notify('uninstall', 'mee');
+   drupal_uninstall_schema('mee');  
  }
 
 /**
@@ -25,3 +27,36 @@
    drupal_load('module', 'content');
    content_notify('disable', 'mee');
  }
+
+/**
+ * Add separate column for the required status
+ */
+function mee_update_6001() {
+  $ret = array();
+  switch ($GLOBALS['db_type']) {
+    case 'mysql':
+    case 'mysqli':
+      $ret[] = update_sql("ALTER TABLE {mee_ressources} ADD required INT NOT NULL DEFAULT 0");
+      break;
+  }
+  return $ret;
+}
+
+
+/**
+ * Implementation of hook_schema().
+ */
+	function mee_schema() {  
+	  $schema['mee_ressources'] = array(
+	    'fields' => array(
+	      'content_nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
+	      'atom_sid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
+	      'field' => array('type' => 'varchar', 'length' => 31, 'not null' => TRUE, 'default' => ''),
+	      'weight' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
+	      'required' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
+	    ),
+	    'primary key' => array('content_nid', 'atom_sid'),
+	  );
+	
+	  return $schema;
+	}