Zen Cart Logo
Forums / General Questions / add prefix to database

add prefix to database

Locked

Views: 3,277

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
9 Nov 2009, 8:48 PM
#1
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,798
Plugin Contributions:
22

add prefix to database

Can I add a database prefix to an already installed and configured shop? What is the easiest and fastest way to do it?

I have 195 tables so renaming it manually is a suicide... I've tried running zc_install again and choose database upgrade, but when i click "upgrade db now" i get a white screen and all it says is ```
in:
[SHOW TABLES]


Also, I can't use addon "database table prefix changer" since it only changes the prefix and i don't have a prefix.

Is there a way to do it from phpmyadmin?

And, yes, I know of all the problems i could (and probably will) have, but i really need to do this.

Edit:
Forgot... ZenCart 1.3.8a, PHP 5.2.6, MySQL 5.0.67-community, still on localhost using xampp

My site - Pro ZC Help
My portfolio | My plugins

9 Nov 2009, 9:52 PM
#2
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: add prefix to database

Is there any compelling reason why you want to add a prefix?

if you are loading another APP into the same dbase, just give the new app a prefix.

20 years a Zencart User

9 Nov 2009, 10:09 PM
#3
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,798
Plugin Contributions:
22

Re: add prefix to database

Here's the whole story:

I've installed zencart almost a year ago and in the meantime have done a lot of modifications. Let's call it Shop1.
Now, I want to open another shop (Shop2) on the same domain but in a different folder. The shop would use a different template. So, I downloaded Shop1 and DB1 to my computer in order to make a new one. Shop2 using DB2 is now fully functional and would like to upload it to go live.

I want to add a prefix to DB2 and then merge it with DB1 so that both shops could use the same database, but different tables. After that, I would change some lines in database_tables.php from Shop2 and remove the prefix so that Shop1 and Shop2 will use SAME customer details. Basically, I want to share customer details between the two shops and this seems like a good idea... This might be a sollution to my earlier post here

If there's a better solution to my problem, please do let me know.

My site - Pro ZC Help
My portfolio | My plugins

9 Nov 2009, 10:39 PM
#4
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: add prefix to database

This will actually cause problems...

The principle behind prefixes is cheifly to allow one database to host two independent sets of data.

Prefixes mean de facto that you have TWO databases, housed in a single "shell".

You are proposing to (later) "blend" the tables and hence the data, but I don't think you have factored in the very taxing question of ID references that are used for RELATIONAL purposes and AUTO INCREMENTS that give a particular data record its unique referencing point.

You will have (in each "database") data that will have the same ID's as data in the other database - but the information that ID refers to will be very different.

When you come to "blending" the data, there can be no duplication of ID's across the relational functionality. MySQL will not allow this to happen anyway, so unless you have a couple of centuries of spare time to manually re-configure all the ID's (and make sure their cross-referencing is 100% accurate as well), then abandon this quest now...

20 years a Zencart User

9 Nov 2009, 10:41 PM
#5
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: add prefix to database

Look in the free add-ons for the multisite mod... It's a more realistic method of doing what you propose. It uses ONE database, with ONE set of data.

20 years a Zencart User

9 Nov 2009, 10:46 PM
#6
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,798
Plugin Contributions:
22

Re: add prefix to database

Oh, yeah, well, I'm simply an expert when it comes to mysql... :lamo: Thank you for saving me both time and sanity...

:cry: So, do you have ANY idea how to do what I want? Because, I don't think I'm asking for much - I just want a customer from shop1 to be able to use the same login on shop2 and not go through the whole process of writing user details again. Is this really such a big problem? :dontgetit

My site - Pro ZC Help
My portfolio | My plugins

9 Nov 2009, 10:55 PM
#7
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: add prefix to database

multisite mod...

20 years a Zencart User

9 Nov 2009, 11:12 PM
#8
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,798
Plugin Contributions:
22

Re: add prefix to database

Are you sure?

I've read the entire thread and as I understand it requires two different domains or IPs. Did you try to use it with only folders on the same domain or maybe know for a fact it works?

My site - Pro ZC Help
My portfolio | My plugins

9 Nov 2009, 11:37 PM
#9
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: add prefix to database

I've not used it, but just looked at what's been said about it. I have no idea if it is suitable for you or not, or whether it is reliable. I just know that it exists and that it presents an opportunity to run several "different" webshops off one database... which is close to where you are coming from.

20 years a Zencart User