内容

有四种方式进行判断:

1. SHOW TABLES LIKE '%tb_bp_d_case%';
2. select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='dbname' and TABLE_NAME='tablename' ;
3. create table if not exists tablename
4. 从模板表创建表:create table if not exists like old_table_name;


字段

if not (columnexists('role_data_blob', 'treasure_trick_data')) then
  alter table `role_data_blob` add column `treasure_trick_data` blob COMMENT '法宝幻象';
end if;