View Single Post
02-16-2011, 11:09 AM   #1
Jeff
Administrator
 
Jeff's Avatar
 
Join Date: Jul 2010
Posts: 402
Rep Power: 10
Jeff is getting browny points
Add Prefix To Existing Vbulletin Tables

If you never used prefixes for your MySQL tables on your vbulletin install and now you want to, here is a little script that will rename all the tables with the desired prefix. You must ONLY RUN THIS SCRIPT ONCE! Upload it to your forum root. After you run it, DELETE IT.

The only thing you can define is the prefix.

Code:
<?php

$prefix = 'vb_';

require_once('./global.php');

$rows = $vbulletin->db->query("SHOW TABLES");

while ($row = $vbulletin->db->fetch_array($rows))
{
    $table_name = $row['Tables_in_rib'];

    $vbulletin->db->query("ALTER TABLE $table_name RENAME TO $prefix$table_name "); 
} 

echo "Completed, delete this file immediately!";

?>
Jeff is offline   Reply With Quote