Project

General

Profile

Feature #14338 » 0000390-rename_tables.sh

Administrator Admin, 2004-09-28 01:16

 
#!/bin/sh

mysql_params=" -B -u root -pmypassword"
prefix="test_"
db_name="dbal_test"

# Print all tables
tables=`mysql ${mysql_params} -s -e "show tables" ${db_name}`

for i in $tables; do
# Prepend every table with the prefix
mysql ${mysql_params} -e "ALTER TABLE \`${i}\` RENAME \`${prefix}${i}\`" ${db_name}
done
(2-2/3)