function simplenews_update_6253 in Simplenews 6.2
Add timestamp field to simplenews subscriptions table. Port timestamps from `simplenews_snid_tid` table to `simplenews_subscriptions`
File
- ./
simplenews.install, line 874 - Simplenews installation.
Code
function simplenews_update_6253() {
$ret = array();
db_add_field($ret, 'simplenews_subscriptions', 'timestamp', array(
'description' => 'UNIX timestamp of when the user first subscribed to a newsletter.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
));
// http://dev.mysql.com/doc/refman/5.1/en/correlated-subqueries.html
// this subquery already works with mysql 4.
db_query("\n UPDATE {simplenews_subscriptions} s\n SET s.timestamp = (\n SELECT MIN(timestamp)\n FROM {simplenews_snid_tid}\n WHERE snid = s.snid\n )");
return $ret;
}