Joining two installations into one

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Joining two installations into one

Jorge Bastos
Howdy,

I have two installs of RC, but I discovered something that already exists,
that is the possibility to have just one install, no matter the number of
servers that I have:

$config['default_host'] = 'mail.%s';

I know it was always there, but I was blind :)
I even can create a separated record for all domains to use an internal IP
if I want, but that's something I'll see if I have the need of, servers are
all in the same datacenter/switch for now.

Thing is, i have:

Install A
Install B

And i have users that have contacts on both sides, and the user ID's will
collide.
What I'm thinking to do it:

On install B
update users set user_id=user_id+10000;
update contacts set user_id=user_id+10000;

and then join this two tables to install A

the database schema is pretty simple, but I'd like an advice/confirmation on
this if possible, 'cause I don't know what will happen when the user_id will
reach the numbers that I incremented, will they collide or it'll check if
the number exists? (I know it's an autoincrement field)

I can always use a very very high value like user_id+100000000, but don't
like the solution,

Thanks in advanced :)

Jorge,
_______________________________________________
Roundcube Users mailing list
[hidden email]
http://lists.roundcube.net/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Joining two installations into one

Steve Perkins

In principle sounds like it would work. I don't know the Roundcube data table structure well enough to know if these are the only changes you would require there, but in answer to your question about auto_increment you can use:

ALTER TABLE tbl AUTO_INCREMENT = 5;

To reset the auto_increment figure in table B at the end so any new records start numbering beyond the merged data.

Also see:
https://dev.mysql.com/doc/refman/5.7/en/example-auto-increment.html

 

Hope this helps.

Steve


On 06-09-2017 17:19, Jorge Bastos wrote:

Howdy,

I have two installs of RC, but I discovered something that already exists,
that is the possibility to have just one install, no matter the number of
servers that I have:

$config['default_host'] = 'mail.%s';

I know it was always there, but I was blind :)
I even can create a separated record for all domains to use an internal IP
if I want, but that's something I'll see if I have the need of, servers are
all in the same datacenter/switch for now.

Thing is, i have:

Install A
Install B

And i have users that have contacts on both sides, and the user ID's will
collide.
What I'm thinking to do it:

On install B
update users set user_id=user_id+10000;
update contacts set user_id=user_id+10000;

and then join this two tables to install A

the database schema is pretty simple, but I'd like an advice/confirmation on
this if possible, 'cause I don't know what will happen when the user_id will
reach the numbers that I incremented, will they collide or it'll check if
the number exists? (I know it's an autoincrement field)

I can always use a very very high value like user_id+100000000, but don't
like the solution,

Thanks in advanced :)

Jorge,
_______________________________________________
Roundcube Users mailing list
[hidden email]
http://lists.roundcube.net/mailman/listinfo/users


_______________________________________________
Roundcube Users mailing list
[hidden email]
http://lists.roundcube.net/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Joining two installations into one

Jorge Bastos

Hi steve,

 

Oh, that’s a pretty good idea, so I’ll just set the next auto increment to the after the last value.

If Alec or Thomas could confirm this would be nice!

 

Thank you all J

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Steve Perkins
Sent: 6 de setembro de 2017 10:40
To: Roundcube Users mailing list <[hidden email]>
Subject: Re: [RCU] Joining two installations into one

 

In principle sounds like it would work. I don't know the Roundcube data table structure well enough to know if these are the only changes you would require there, but in answer to your question about auto_increment you can use:

ALTER TABLE tbl AUTO_INCREMENT = 5;

To reset the auto_increment figure in table B at the end so any new records start numbering beyond the merged data.

Also see:
https://dev.mysql.com/doc/refman/5.7/en/example-auto-increment.html

 

Hope this helps.

Steve

 

On 06-09-2017 17:19, Jorge Bastos wrote:

Howdy,

I have two installs of RC, but I discovered something that already exists,
that is the possibility to have just one install, no matter the number of
servers that I have:

$config['default_host'] = 'mail.%s';

I know it was always there, but I was blind :)
I even can create a separated record for all domains to use an internal IP
if I want, but that's something I'll see if I have the need of, servers are
all in the same datacenter/switch for now.

Thing is, i have:

Install A
Install B

And i have users that have contacts on both sides, and the user ID's will
collide.
What I'm thinking to do it:

On install B
update users set user_id=user_id+10000;
update contacts set user_id=user_id+10000;

and then join this two tables to install A

the database schema is pretty simple, but I'd like an advice/confirmation on
this if possible, 'cause I don't know what will happen when the user_id will
reach the numbers that I incremented, will they collide or it'll check if
the number exists? (I know it's an autoincrement field)

I can always use a very very high value like user_id+100000000, but don't
like the solution,

Thanks in advanced :)

Jorge,
_______________________________________________
Roundcube Users mailing list
[hidden email]
http://lists.roundcube.net/mailman/listinfo/users


_______________________________________________
Roundcube Users mailing list
[hidden email]
http://lists.roundcube.net/mailman/listinfo/users