Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Changing the Database Table Prefix

BenBen
edited July 2007 in Vanilla 1.0 Help
I'd like to run multiple installations of Vanilla on my server, but I only have one mySQL database.

I edited the mysql files to create differently named sets of tables. But I can't find anywhere to tell Vanilla to use a different prefix.

Is there any way to change the table prefix of either 0.9.2 or version 1? From LUM_ to something else?

Well I just found the last time I asked this. Mark said then it would be an option in the next version, but I can't see where this option is.

Comments

  • MarkMark Vanilla Staff
    $Configuration['DATABASE_TABLE_PREFIX'] = 'whatever';
  • KrakKrak New
    edited April 2006
    dont you need to change

    $DatabaseTables['User'] = 'LUM_User';

    also?
  • MarkMark Vanilla Staff
    No. The user table doesn't rely on the Database prefix. It must always be declared explicitly.
  • BenBen
    edited April 2006
    Isn't there an additional file that contains some user table info, with its own prefix that needs to be defined? Where does the user table need to be defined then?
  • MarkMark Vanilla Staff
    edited April 2006
    What are you talking about?

    It *is* defined in appg/database.php *WITH* the LUM_ prefix.

    The SqlBuilder object doesn't add any prefix to the user table.

    This is done so that you can explicitly define a user table with a name other than "LUM_User".

    So, if you were going to integrate Vanilla's user table with your TennisShoeWarehouse database, you could open up your conf/database.php and add this:

    $DatabaseTables['User'] = 'TennisShoeWarehouseUsers';
  • Ahh.. Ingenious. I was looking in the conf/database.php
  • Wahey! I now have a fully working installation of revision 375.
  • Apologies, I'm a Vanilla n00b. But where do I find "$Configuration['DATABASE_TABLE_PREFIX']"? Is it something that's preconfigured or do I have to add this variable in?
  • I'm guessing its in appg/settings.php. Copy the line in there into conf/settings.php and change the prefix as necessary.
  • Found it, thanks lots ;)
  • So I've installed Vanilla, renamed all the tables, added "$Configuration['DATABASE_TABLE_PREFIX'] = 'ph_forum_';" to conf/settings.php It should work, right? Think again... when trying to sign in it comes up with... "The error occurred on or near: Table 'db213135163.LUM_User' doesn't exist" Why is it still looking for tables with prefix LUM?
  • Because the user table name setting is seperate. You'd need to copy that into your conf/settings.php too and change it to ph_forum_User
  • Genius! I love you! Thanks for putting up with a n00b :)
  • Just a note here: During my current integration of my own app and vanilla, I wanted to integrate both user- and role-tables. Solution: I named the prefix '' (empty) and added the prefixes manually to each table in database.php I understand the point of having the user table named explicitly, but it's inconsistent. Maybe you could use the prefix in defining the tables in appg/database.php? in appg/settings.php: $Configuration['DATABASE_TABLE_PREFIX'] = 'LUM_'; in appg/database.php $DatabaseTables['User'] = $Configuration['DATABASE_TABLE_PREFIX'] . 'User'; $DatabaseTables['Role'] = $Configuration['DATABASE_TABLE_PREFIX'] . 'Role';
This discussion has been closed.