Index: twitter.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/twitter/twitter.install,v
retrieving revision 1.2.2.3
diff -b -u -p -r1.2.2.3 twitter.install
--- twitter.install	8 Apr 2009 07:12:30 -0000	1.2.2.3
+++ twitter.install	11 Apr 2009 02:29:17 -0000
@@ -122,7 +122,8 @@ function twitter_schema() {
       'screen_name' => array(
         'description' => t("The unique login name for the Twitter account."),
         'type' => 'varchar',
-        'length' => 255
+        'length' => 255,
+        'not null' => TRUE,
       ),
       'password' => array(
         'description' => t("The password for the Twitter account."),
@@ -204,6 +205,19 @@ function twitter_update_6002() {
   return $ret;
 }
 
+/**
+ * Add NOT NULL constraint to the screen_name field of the twitter_user table
+ * as this field is part of the PRIMARY KEY definition. See http://drupal.org/node/336048
+ */
+function twitter_update_6003() {
+  $ret = array();
+  // First have to drop PRIMARY KEY and indexes that use the field being changed.
+  db_drop_index($ret, 'twitter_user', 'screen_name');
+  db_drop_primary_key($ret, 'twitter_user');
+  db_change_field($ret, 'twitter_user', 'screen_name', 'screen_name', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), array('primary key' => array('screen_name'), 'indexes' => array('screen_name' => array('screen_name'))));
+  return $ret;
+}
+
 function twitter_uninstall() {
   // Remove tables.
   drupal_uninstall_schema('twitter');
