PDA

View Full Version : database schema name prepend


buro9
Mon 26th Nov '01, 5:02am
I would like to have the option on install to prepend the vbulletin tables with a schema identifier.

Obviously this would change the installer and a relevant var will prepend this to all queries.

This is to allow users such as myself, who are restricted to a single mysql database to install other products... at the moment i cannot install a sitewide registration product as the tablename 'users' is already taken by vB... and I don't want to change vB's default tables (adding columns) as then I am creating one hell of a mess for myself when it comes to product upgrades in future.

So what I would like to see is a default prepend of vBulletin database tables... so all tables take the name:

vb_<<table_name>>

such as:

vb_users

but for the 'vb_' bit to be user selectable at time of install.

Is there such a hack already?
Would it be so hard to create one?
It would make my life a darn sight easier to have my board on the same domain name as my site (my host only allowing one mysql db per domain).

And one more point... if you really are going for the enterprise market, I can tell you straight out that this will be a core requirement... as it's one of the things we've insisted on products we've purchased... ability to prepend all packages, tables, etc with a schema identifier if they are using 'common' tablenames like 'templates' and 'users'. This is the best way of guaranteeing not clashing with legacy code that most organisations have and are loathed to touch.

Cheers

David K

Chen
Mon 26th Nov '01, 12:09pm
I can tell you now for sure, there's no hack for this.
Doing this will require you to change all queries to fix the table name in them.

Wayne Luke
Mon 26th Nov '01, 1:18pm
Adding a static prequalifier to the vBulletin tables has been discussed for the next rewrite. However due to the system design adding a dynamic one has been ruled out.

We will however review the request more indepth as development continues.

Daroz
Tue 27th Nov '01, 8:43am
I don't see this being that hard, outside a major grep and edit operation... For example:

In config.php:

// Don't change this line after installation
$prependtable="vb_";


And for the queries:

$qry="select * from ".$prependtable."user where usergroup=1";


Works just fine for my other projects. You could even write a cp applet to edit that one line in confg.php and rename all the tables.

-- Daroz

Chen
Tue 27th Nov '01, 9:13am
Originally posted by Daroz
I don't see this being that hard, outside a major grep and edit operation... For example:

In config.php:

// Don't change this line after installation
$prependtable="vb_";


And for the queries:

$qry="select * from ".$prependtable."user where usergroup=1";


Works just fine for my other projects. You could even write a cp applet to edit that one line in confg.php and rename all the tables.

-- Daroz
Yes, but imagine editing all the queries vBulletin has in its files.
That's a lot of queries.

Someone can sure do this for his own board, but releasing this as a hack is almost impossible.

Daroz
Tue 27th Nov '01, 9:22am
Originally posted by FireFly

Yes, but imagine editing all the queries vBulletin has in its files.
That's a lot of queries.

Someone can sure do this for his own board, but releasing this as a hack is almost impossible.

I never said hack... *hint*hint*

:D

-- Daroz

buro9
Sun 2nd Dec '01, 7:03am
i don't think this could be a hack either.
but it should be part of an official release.
it's immediately backwards compatible due to the fact that the prepend value would just be null for existing accounts!

cheers

david k

buro9
Sun 2nd Dec '01, 7:05am
i tell you what, give me the latest copy of your source, and i'll make all the changes in less than a day (regexp parsing in slickedit here i come!)... and then i'll give it back to you and you can release it.

i can't do this as a hack, as every update would over write it and screw up my board!

david k

Chen
Sun 2nd Dec '01, 11:24am
Rest assured the developers can also do this themselves - they're not paid to just sit there and stare at the screen. :)
That's not a problem.