I'm surprised to see that no update function takes care of dropping the old {sequences} table ?
Maybe that was intended ? so that contrib modules still can use its content when they do their own update ? I dunno, just guessing.

If not, attached patch adds an update function to drop it.

Comments

hass’s picture

There was an discussion about this many month ago and as i remember - the decision was to drop this table for backward compatibility in D7 and not in D6.

hass’s picture

Status: Needs review » Postponed
hass’s picture

Version: 6.x-dev » 7.x-dev
Status: Postponed » Needs review
yched’s picture

OK, I must've missed that one. Thx hass

catch’s picture

Title: {sequences} table is not dropped ? » Remove {sequences} table
Category: bug » task
Status: Needs review » Needs work

Might as well do this early in D7. Needs a re-roll though.

dave reid’s picture

Plus, we are still going to probably need the sequences table for replacing the stupid actions_id table. See #356074: Provide a sequences API.

hass’s picture

Status: Needs work » Needs review
StatusFileSize
new691 bytes

Patch attached.

Status: Needs review » Needs work

The last submitted patch failed testing.

hass’s picture

Status: Needs work » Needs review
StatusFileSize
new689 bytes

Re-roled

catch’s picture

Status: Needs review » Needs work

I think there's some D6 modules which still use the sequences table (if not there could be custom modules). If it's possible, I think we should consult the schema for the site before dropping it, otherwise just leave it as is.

hass’s picture

Status: Needs work » Needs review

db_next_id has been removed in D6... there cannot be any module that use this table. If still used in a module than not in an API way and the module hasn't been upgraded correctly to D6. All D6 modules need to use db_last_insert_id. Aside we remove the table in D7, not D6. Can you name the modules?

catch’s picture

Here they are. Not obscure modules.

catch@catch-laptop:~/www/contrib/6.x$ grep -r "{sequence" *
DRUPAL-6--1/activity/tests/ActivityAPITests.test:    $this->sequences_id = db_result(db_query("SELECT id FROM {sequences} WHERE name = 'activity'"));
DRUPAL-6--1/activity/tests/ActivityAPITests.test:    db_query("UPDATE {sequences} SET id = %d WHERE name = 'activity'", $this->sequences_id);
DRUPAL-6--1/phpbb2drupal/phpbb2drupal.module:  db_query("DELETE FROM {sequences} WHERE name='term_data_tid'");
DRUPAL-6--1/phpbb2drupal/phpbb2drupal.module:  db_query("DELETE FROM {sequences} WHERE name='comments_cid'");
DRUPAL-6--1/phpbb2drupal/phpbb2drupal.module:  db_query("DELETE FROM {sequences} WHERE name='node_nid'");
DRUPAL-6--1/phpbb2drupal/phpbb2drupal.module:  db_query("DELETE FROM {sequences} WHERE name='users_uid'");
DRUPAL-6--1/phpbb2drupal/phpbb2drupal.module:  db_query("INSERT INTO {sequences} (name,id) VALUES ('term_data_tid', '%s')", $term_data_tid);
DRUPAL-6--1/phpbb2drupal/phpbb2drupal.module:  db_query("INSERT INTO {sequences} (name,id) VALUES ('comments_cid', '%s')", $comments_cid);
DRUPAL-6--1/phpbb2drupal/phpbb2drupal.module:  db_query("INSERT INTO {sequences} (name,id) VALUES ('node_nid', '%s')", $node_nid);
DRUPAL-6--1/phpbb2drupal/phpbb2drupal.module:  db_query("INSERT INTO {sequences} (name,id) VALUES ('users_uid', '%s')", $users_uid);
DRUPAL-6--1/phpbb2drupal/phpbb2drupal.module:    db_query("DELETE FROM {sequences} WHERE name='files_fid'");
DRUPAL-6--1/phpbb2drupal/phpbb2drupal.module:    db_query("INSERT INTO {sequences} (name,id) VALUES ('files_fid', '%s')", $files_fid);
DRUPAL-6--1/comment_upload/comment_upload.install:    $ret[] = update_sql("INSERT INTO {sequences} (name, id) VALUES('". db_prefix_tables('{comment_upload_files}') ."_fid', $max_fid)");
DRUPAL-6--1/marc/marc.module:      //$nid = db_result(db_query("SELECT id FROM {sequences} WHERE name = '%s'", db_prefix_tables('node_nid')));
DRUPAL-6--1/devel/devel.module:  db_query("UPDATE {sequences} SET id = $max WHERE name='${table}_$column'");
DRUPAL-6--1/delete_all/delete_all.module:  db_query("UPDATE {sequences} SET id = 1 WHERE name = 'users_uid'");
DRUPAL-6--1/votingapi/votingapi.install:      $ret[] = update_sql("UPDATE {sequences} SET name = '{votingapi_cache}' WHERE name = 'votingapi_cache';");
DRUPAL-6--1/votingapi/votingapi.install:      $ret[] = update_sql("UPDATE {sequences} SET name = '{votingapi_vote}' WHERE name = 'votingapi_vote';");
DRUPAL-6--2/links/docs/API.html:|                 |                  | "links_lid" in table {sequences}.      |
DRUPAL-6--2/ubercart/uc_product/uc_product.install:    $ret[] = update_sql("INSERT INTO {sequences} (name, id) VALUES ('{uc_class_fields}_cfid', %d)", $max_id);
DRUPAL-6--2/ubercart/uc_store/uc_store.install:  $ret[] = update_sql("INSERT INTO {sequences} VALUES ('{uc_zones}_zone_id', $max_id)");
DRUPAL-6--2/ubercart/payment/uc_payment/uc_payment.install:    $ret[] = update_sql("INSERT INTO {sequences} VALUES ('{uc_payment_receipts}_receipt_id', $max_id)");
DRUPAL-6--2/ubercart/payment/uc_payment/uc_payment.install:    $ret[] = update_sql("INSERT INTO {sequences} VALUES ('{uc_payment_check}_check_id', $max_id)");
DRUPAL-6--2/ubercart/payment/uc_credit/uc_credit.install:    $ret[] = update_sql("INSERT INTO {sequences} VALUES ('{uc_payment_credit}_credit_id', ". $max .")");
DRUPAL-6--2/ubercart/uc_order/uc_order.install:    $result = db_query("INSERT INTO {sequences} (name, id) VALUES ('{uc_orders}_order_id', %d)", $data->order_id);
DRUPAL-6--2/ubercart/uc_order/uc_order.install:    $ret[] = array('success' => $result !== FALSE, 'query' => "INSERT INTO {sequences} (name, id) VALUES ('{uc_orders}_order_id'. ". $data->order_id .")");
DRUPAL-6--2/ubercart/uc_order/uc_order.install:    $ret[] = update_sql("INSERT INTO {sequences} (name, id) VALUES ('{uc_order_products}_order_product_id', $max_opid)");
DRUPAL-6--2/webform/webform.install:      db_query('LOCK TABLES {sequences} WRITE');
DRUPAL-6--2/webform/webform.install:      $ret[] = update_sql(sprintf("UPDATE {sequences} SET name = '%s' WHERE name = '%s'", db_prefix_tables('{webform_submissions}_sid'), db_prefix_tables('{webform_submissions}_id')));
DRUPAL-6--2/votingapi/votingapi.install:      $ret[] = update_sql("UPDATE {sequences} SET name = '{votingapi_cache}' WHERE name = 'votingapi_cache';");
DRUPAL-6--2/votingapi/votingapi.install:      $ret[] = update_sql("UPDATE {sequences} SET name = '{votingapi_vote}' WHERE name = 'votingapi_vote';");
DRUPAL-6--2/imagecache/imagecache.install:      $ret[] = update_sql("INSERT INTO {sequences} (name, id) VALUES ('{imagecache_action}_actionid', $count_action)");
DRUPAL-6--2/imagecache/imagecache.install:      $ret[] = update_sql("INSERT INTO {sequences} (name, id) VALUES ('{imagecache_preset}_presetid', $count_preset)");
DRUPAL-6--2/imagecache/imagecache.install:      $ret[] = update_sql("DELETE FROM {sequences} WHERE name = '{{$table}}_{$field}'");
DRUPAL-6--3/panels/panels.install:    $ret[] = update_sql("INSERT INTO {sequences} (name, id) VALUES ('{panels_page}_pid', $max_pid)");
DRUPAL-6--3/panels/panels.install:    $ret[] = update_sql("INSERT INTO {sequences} (name, id) VALUES ('{panels_pane}_pid', $count)");
DRUPAL-6--3/panels/panels.install:    $ret[] = update_sql("INSERT INTO {sequences} (name, id) VALUES ('{panels_display}_did', $max_did)");
DRUPAL-6--3/panels/panels.install:  $ret[] = update_sql("DELETE FROM {sequences} WHERE name = '{panels_display}_did'");
DRUPAL-6--3/panels/panels.install:  $ret[] = update_sql("DELETE FROM {sequences} WHERE name = '{panels_display}_id'");
DRUPAL-6--3/panels/panels.install:    $ret[] = update_sql("INSERT INTO {sequences} (name, id) VALUES ('{panels_display}_did',
DRUPAL-6--3/location/location.install:      db_query("INSERT INTO {sequences} (name, id) VALUES ('{location}_lid', %d)", $next_id);
catch’s picture

Status: Needs review » Needs work

So to remove this, I think we need a sequences module in contrib (even if it's just a hook_schema() and hook_install() and nothing else), and then the schema check here. I don't see a way for all those D6 modules to provide a unified upgrade path to D7 all at the same time otherwise.

hass’s picture

If we would consequently drop the table it wouldn't be used any longer :-). No idea why they use obsolete tables.

Leeteq’s picture

Subscribing.

webchick’s picture

Status: Needs work » Closed (won't fix)

Now that we actually have a sequences table again, this is won't fix.