BS"D

When I added a shared_ prefix to my sequence table the Fierce SSO worked perfectly but now I am unable to add menu items and apparently the cause is the following:

The 'sequences' table uses the prefixed table name for the 'name' field and because it wasn't finding that entry, it created a new one and started all over again.

*** If you add a prefix to the tables on an existing site, you must add the prefix to the 'name' field of all records on this file.

How do I get around this, or how do I do what is necessary in the sequences table? Thanks, IS

Comments

eli’s picture

Priority: Critical » Normal

Hello,

I'm not quite sure I followed that, so let me try to recap: You have multiple drupal installs sharing a database and recently switched your sequences table to be shared across the sites and installed FierceSSO. And now you're having problems adding menu items... right?

This isn't a problem with this module per se, but with how Drupal uses the sequences table. It has to work this way -- how else would it tell which sequence number references the menu id for sitea versus siteb?

How did you create shared_sequences in the first place? Did you just rename the table from one of the sites? If you've still got the old tables laying around, a quick bit of SQL magic should be able to automatically append the proper prefix onto the entries. (Or you could just go through the table by hand -- I doubt there are many rows)

Eli

ISchier770’s picture

BS"D

Thanks for your reply!

I had created both of the sites, and then I changed the prefix for the tables on one of them (the one that had been up for a while and had more data) to shared_

(what had been just plain sequences became shared_sequences; ditto for the rest of them, such as users, that were changed to shared_).

I did not delete the old tables from the second, newer site so that there are 2 _sequences tables, one shared_sequences and one whatever_sequences (with whatever being the name of the tables for the second site).

Do I need to delete the duplicate tables? Otherwise, what prefix do I apply and where? Thanks again!

eli’s picture

So just to be 100% clear, the items in the original sequence table did not have any prefix, right? (That is, it just looked like "menu_cid" not "something_menu_cid")

Well, how comfortable are you with SQL? If you open up your database using the mysql command line client or phpMySQL and enter the following two commands (replacing the prefix and table names with your names)... Don't forget to back up your database first!

replace into shared_sequences (select concat('siteone_',name),id from siteone_sequences);
replace into shared_sequences (select concat('sitetwo_',name),id from sitetwo_sequences);

it should populate the shared sequences table properly (possibly blowing away whatever values are in there currently).

If after doing that you still have errors about duplicate IDs (which would happen if you created new content since merging the tables the first time), here's a little SQL hack:

update shared_sequences set id = id + 100;

That just skips 100 values for each of the sequences.

Cheers,
Eli

ISchier770’s picture

BS"D

Thanks.

What I have actually is one menu_nid with no prefix and one menu_nid with the prefix of the second site (site2_menu_nid) both in shared_sequences.

eli’s picture

Well, you might want to consider starting the merge over again at this point, if you haven't added much.

But this should fix the table for you:

update shared_sequences set name = concat('site1_',name) where name not like 'site2\_%';

And then I'd throw in:

update shared_sequences set id = id + 100;

for good measure

ISchier770’s picture

BS"D

Executed the commands; all is well!

Thanks again for all your assistance! Everything seems to be working now and your module really does a great job!

ISchier770’s picture

Status: Active » Closed (fixed)

BS"D

Problem started again:

user warning: Duplicate entry '3' for key 1 query: INSERT INTO menu (mid, pid, path, title, description, weight, type) VALUES (3, 1, 'http://www.millionwordimension.info', 'MillionWorDimension.info', 'Simple List of Words for SEO!', 5, 118) in /home/cybfirmc/domains/millionwordimension.com/includes/database.mysql.inc on line 174.

Is there any way I can prevent this from reoccuring? In the meantime I am repeating the process you posted earlier. Thanks, Itzhak

ISchier770’s picture

Priority: Normal » Critical
Status: Closed (fixed) » Active
eli’s picture

Priority: Critical » Normal
Status: Active » Closed (fixed)

Are you sure you ran this?

update shared_sequences set id = id + 100;

If it's still a problem, I think you'll get better help opening an issue in the Drupal support forum or posting on the Multisite Drupal group. It's not an issue with this module, and I'm about out of ideas.

Eli

ISchier770’s picture

Priority: Normal » Critical
Status: Closed (fixed) » Active

BS"D

Problem started again:

user warning: Duplicate entry '3' for key 1 query: INSERT INTO menu (mid, pid, path, title, description, weight, type) VALUES (3, 1, 'http://www.millionwordimension.info', 'MillionWorDimension.info', 'Simple List of Words for SEO!', 5, 118) in /home/cybfirmc/domains/millionwordimension.com/includes/database.mysql.inc on line 174.

Is there any way I can prevent this from reoccuring? In the meantime I am repeating the process you posted earlier. Thanks, Itzhak

ISchier770’s picture

BS"D

Thanks again. I am going to check and make sure my hosting co did not adjust the database in any way and if they can't help I will post to one of those 2 forums. It was working perfectly and now all of a sudden, with no changes made except that I uploaded but did not activate a few modules, the problem started again.

eli’s picture

Status: Active » Closed (fixed)