Hi, can anyone give me pointers on the following issues;-

I have a number of co-branded Drupal sites which are working well, however the Astbill accounting package attached to the sites is not working too well, whilst I wait for the Astbill developers to solve the issue,, I have a simple fix, but i don't know how to implement it!

That said the question is " if the databases are suitably prefixed 'A' 'B' 'C' etc how can i set the uid for each database/table to start at a different number range, e.g. 'A' Starts at 2 - 15000, 'B' starts at 15001 and so on" this will fix the accounting problem.

Please help, I'm really stuck
RobinD

Comments

bjornarneson’s picture

Login to the database (with phpMyAdmin or another tool) that you want to adjust and run this MYSQL query:

update sequences set id = '15000' where name = 'users_uid'

This will update the sequences table so that the next created user will have UID = 15001.

Repeat these steps for each of the sites/dbs that you want to account for in this way, changing "15000" to the starting ID you'd like to use.

-b

bjornarneson’s picture

If you are working with one database with table prefixes for different sites, your code should look something like

update [prefix_]sequences set id = '15000' where name = 'users_uid'

where [prefix_] = the actual table prefix you set during installation.

This code is untested, so be sure to take a full backup of your DB!

RobinD’s picture

Thank you your response looks just the ticket

Regards

RobinD’s picture

HI,

I ended up with the following:

update pbxa_users sequences set uid = '15000' where name = 'users_uid'

this did place 15000 in the table as UID, however when a new user registers the system sequencies from the old numbering scheme, so whilst we registered a UID to 15000, it hasn't set the sequence.

where have I gone wrong?

regards

rstamm’s picture

the sql statement is
update [prefix1]sequences set id = '15000' where name = '[prefix2]users_uid'

prefix1 and prefix2 can be the same or different, depends on your settings.

prefix2 is the same as the prefix of db table users.

Michael Hofmockel’s picture

I have two sites running from the same Drupal4.7 instance as explained in install.txt.

These two sites have seperate databases but share users. I did this by editing $db_prefix in the slave site's settings.php. As explained at http://drupal.org/node/22268.

I got errors like "Duplicate entry.." when trying to create a new user. As if the sequences table was not being shared.

The difficulty came in not recognizing that the $db_prefix in the master site's settings.php must also be edited.

The $db_prefix variable is carried into the sequences table. So, even though I was using the same sequences table for both databases, Drupal was making seperate entries for each site using the prefix as part of the "name" column.

Solution:

Settings.php for the slave site should have this -

$db_url = 'mysql://user:pass@host/slave';
$db_prefix = array(
"default" => "slave.",
"users" => "master.",
"sessions" => "master.",
"authmap" => "master.",
"sequences" => "master.",
"profile_fields" => "master.",
"profile_values" => "master.",
"role" => "master.",
"user_roles" => "master.",
);

Settings.php for the master site should have this -

$db_url = 'mysql://user:pass@host/master';
$db_prefix = array(
"default" => "master.",
);

HofMonkey
Open-Source | Open-Access | Open-Mind