最近在看一个快速开发框架,在搭建环境过程中发现框架认不到小写的数据库表名,应该和我使用的 Linux 系统有关,于是找到这么一个解决方法,能够批量地将所有小写的表名转为大写:
select concat('rename table ', table_name, ' to ' , upper(table_name) , ';') from information_schema.tables where table_schema = '《这里填写你的数据库名》';
执行上面的语句后,便可以自动生成下列的语句:
rename table sys_config to SYS_CONFIG;
rename table sys_dept to SYS_DEPT;
rename table sys_dict_data to SYS_DICT_DATA;
rename table sys_dict_type to SYS_DICT_TYPE;
rename table sys_job to SYS_JOB;
rename table sys_job_log to SYS_JOB_LOG;
rename table sys_logininfor to SYS_LOGININFOR;
rename table sys_menu to SYS_MENU;
rename table sys_notice to SYS_NOTICE;
rename table sys_oper_log to SYS_OPER_LOG;
rename table sys_post to SYS_POST;
rename table sys_role to SYS_ROLE;
rename table sys_role_dept to SYS_ROLE_DEPT;
rename table sys_role_menu to SYS_ROLE_MENU;
rename table sys_user to SYS_USER;
rename table sys_user_post to SYS_USER_POST;
rename table sys_user_role to SYS_USER_ROLE
// ....
然后只要复制这些语句执行就可以。