Index: /sandbox/2.4.1-3/expressoMail1_2/setup/tables_current.inc.php
===================================================================
--- /sandbox/2.4.1-3/expressoMail1_2/setup/tables_current.inc.php	(revision 5981)
+++ /sandbox/2.4.1-3/expressoMail1_2/setup/tables_current.inc.php	(revision 6386)
@@ -12,12 +12,16 @@
 		'phpgw_expressomail_contacts' => array(
 			'fd' => array(
-				'id_owner' => array( 'type' => 'int', 'precision' => 8, 'nullable' => false),
-				'data' => array( 'type' => 'text')
+				'id' => array('type' => 'auto','nullable' => False),
+				'owner' => array('type' => 'int','precision' => '16','nullable' => False),
+				'name' => array('type' => 'varchar','precision' => '100','nullable' => true),
+				'mail' => array('type' => 'varchar','precision' => '100','nullable' => False),
+				'timestamp' => array('type' => 'int','precision' => '16','nullable' => False),
 			),
-			'pk' => array('id_owner'),
+			'pk' => array('id'),
 			'fk' => array(),
 			'ix' => array(),
 			'uc' => array()
 		),
+		
         'phpgw_certificados' => array(
             'fd' => array(
Index: /sandbox/2.4.1-3/expressoMail1_2/setup/tables_update.inc.php
===================================================================
--- /sandbox/2.4.1-3/expressoMail1_2/setup/tables_update.inc.php	(revision 6185)
+++ /sandbox/2.4.1-3/expressoMail1_2/setup/tables_update.inc.php	(revision 6386)
@@ -263,4 +263,47 @@
 	    return $GLOBALS['setup_info']['expressoMail1_2']['currentver'];
 	}
+
+	$test[] = '2.4.6';
+	function expressoMail1_2_upgrade2_4_6() {
+		$oProc = $GLOBALS['phpgw_setup']->oProc;
+
+		//Criando nova tabela de contatos dinamicos
+		$oProc->CreateTable('expressomail_dynamic_contact',array(
+			'fd' => array(
+				'id' => array('type' => 'auto','nullable' => False),
+				'owner' => array('type' => 'int','precision' => '16','nullable' => False),
+				'name' => array('type' => 'varchar','precision' => '100','nullable' => true),
+				'mail' => array('type' => 'varchar','precision' => '100','nullable' => False),
+				'timestamp' => array('type' => 'int','precision' => '16','nullable' => False),
+			),
+			'pk' => array('id'),
+			'fk' => array(),
+			'ix' => array(),
+			'uc' => array()
+			)
+		);
+
+		//Migra dados antigos para nova tabela
+		$oProc->query('SELECT * FROM phpgw_expressomail_contacts');
+		$return = array();
+        while($oProc->next_record())
+        	$return[$oProc->f('id_owner')] = $oProc->f('data');
+
+        foreach ($return as $owner => &$value) {
+        	$contacts = unserialize($value);
+        	foreach ($contacts as &$contact) {
+        		$info = explode('#', $contact['email']);
+        		$oProc->query("INSERT INTO expressomail_dynamic_contact (owner, name ,mail , timestamp) values ('".$owner."', '".$info[0]."', '".$info[1]."', '".$contact['timestamp']."');");
+        	}
+        }
+        ////////////////////////////////////////////////////////////
+
+        //Deleta tabela antiga
+		$oProc->DropTable('phpgw_expressomail_contacts');
+        
+
+		$GLOBALS['setup_info']['expressoMail1_2']['currentver'] = '2.4.7';
+	    return $GLOBALS['setup_info']['expressoMail1_2']['currentver'];
+	}
 	
 ?>
Index: /sandbox/2.4.1-3/expressoMail1_2/setup/setup.inc.php
===================================================================
--- /sandbox/2.4.1-3/expressoMail1_2/setup/setup.inc.php	(revision 5988)
+++ /sandbox/2.4.1-3/expressoMail1_2/setup/setup.inc.php	(revision 6386)
@@ -13,7 +13,6 @@
 $setup_info['expressoMail1_2']['name'] = 'expressoMail1_2';
 $setup_info['expressoMail1_2']['title'] = 'Expresso Mail';
-$setup_info['expressoMail1_2']['version'] = '2.4.6';
-$setup_info['expressoMail1_2']['app_order'] = 2;
-$setup_info['expressoMail1_2']['tables'][] = 'phpgw_expressomail_contacts';
+$setup_info['expressoMail1_2']['version'] = '2.4.7';
+$setup_info['expressoMail1_2']['app_order'] = 2
 $setup_info['expressoMail1_2']['tables'][] = 'phpgw_certificados';
 
@@ -22,4 +21,5 @@
 $setup_info['expressoMail1_2']['tables'][] = 'expressomail_message_followupflag';
 $setup_info['expressoMail1_2']['tables'][] = 'expressomail_followupflag';
+$setup_info['expressoMail1_2']['tables'][] = 'expressomail_dynamic_contact';
 
 
