system_update_7044

Versions
7
system_update_7044()

Reuse the actions_aid table as sequences.

Related topics

Code

modules/system/system.install, line 2632

<?php
function system_update_7044() {
  $schema['sequences'] = array(
    'description' => 'Stores IDs.',
    'fields' => array(
      'value' => array(
        'description' => 'The value of the sequence.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
     ),
    'primary key' => array('value'),
  );
  db_create_table('sequences', $schema['sequences']);
  $max_aid = db_query('SELECT MAX(aid) FROM {actions_aid}')->fetchField();
  $max_uid = db_query('SELECT MAX(uid) FROM {users}')->fetchField();
  db_insert('sequences')->fields(array('value' => max($max_aid, $max_uid)))->execute();
  db_drop_table('actions_aid');
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.