OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Installation using table prefix

Are you responsible for making OCS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, michael, John

Forum rules
What to do if you have a technical problem with OCS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved. Please note that this FAQ is OJS-centric, but most issues are applicable to both platforms.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OCS Conference Support and Discussion subforum; if you have a development question, try the OCS Development subforum.

Installation using table prefix

Postby cveraq » Sat Aug 06, 2011 5:28 pm

Hi I have a server with allow me use only one database (MySQL) . I use several applications like Moodle, joomla and more and it works fine. Those app allow me when install to choose my table prefix so I can use the same unique Database.. For example for Moodle I choose mod_ as prefix and for joomla joo_ so I can have a table user in both applications but the system treat it as mod_users and joo_users..

I would like to have this option in OCS I mean being able to choose a prefix like ocs_ when installing so I can have another table named ocs_users for this application..

I can try a manual installation but I'm not expert in programmin (moodle and joomla allow me choose the prefix and do automatically all the installation process)

May somebody let me know what to modify in the MySQL scritpt in orden to have this done? I see that we have a CREATE TABLE statement so for example when it say CREATE TABLE USERS I can change to CREATE TABLE OCS_USERS but I'm not sure if this have to be done in all the code and also when it say alter table and index...

Maybe somebody can help me with this so I can run de script and have my OCS system installed?

I can send the mysql script if necessary.. I was trying to modify it manually but I'm not sure if is only a matter of change the name of tables.. because there is a lot of code as index, alter, and more than I understand must be also modified... I can send the MySQL script if somebody can help with this..

Thank you

Carlos
cveraq
 
Posts: 3
Joined: Sat Aug 06, 2011 5:08 pm

Re: Installation using table prefix

Postby JasonNugent » Sun Aug 07, 2011 6:45 am

Hi Carlos,

having a table prefix for a shared database environment is probably a good idea, although it's quite a bit of work to implement. You could modify the table creation scripts to include a prefix, but you would also have to examine all of the SQL in the OCS (and the PKP library) code base to prepend that prefix to each table named in the SQL.

There are plugin hooks that can be used to modify the SQL in the various DAO methods, but I suspect that doing it there would not be very robust.

Regards,

Jason
JasonNugent
Site Admin
 
Posts: 849
Joined: Tue Jan 10, 2006 6:20 am

Re: Installation using table prefix

Postby cveraq » Sun Aug 07, 2011 7:10 am

Dear Jason, thank you. I make manual modifications to script but as you mentioned it means to modify lot of files and maybe you always make a mistake or forgot to modify some line of code or some file(s) and system will fail

Maybe we can have this feature in some new version of OCS. I see that some users request this on another developments from several years ago..

Thank you

Carlos
cveraq
 
Posts: 3
Joined: Sat Aug 06, 2011 5:08 pm

Re: Installation using table prefix

Postby asmecher » Sun Aug 07, 2011 2:08 pm

Hi Carlos,

We have had a few requests for this, but it's difficult because we're using ADODB for database abstraction and it doesn't support table prefixes. If you only have one application that doesn't support table prefixes, you should be OK -- but if you add a second, you'll risk table name conflicts e.g. with common names like "users".

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8321
Joined: Wed Aug 10, 2005 12:56 pm

Re: Installation using table prefix

Postby cveraq » Sun Aug 07, 2011 2:13 pm

One simple solution from you guys is not use generic names like "users" for tables.. Maybe "ocs_users" is better and is not generic!

Carlos
cveraq
 
Posts: 3
Joined: Sat Aug 06, 2011 5:08 pm


Return to OCS Technical Support

Who is online

Users browsing this forum: Bing [Bot] and 3 guests