时间:2021-07-01 10:21:17 帮助过:3人阅读
判断索引是否存在:
DROP PROCEDURE IF EXISTS schema_change; DELIMITER // CREATE PROCEDURE schema_change() BEGIN DECLARE CurrentDatabase VARCHAR(100); SELECT DATABASE() INTO CurrentDatabase; IF NOT EXISTS (SELECT * FROM information_schema.statistics WHERE table_schema=CurrentDatabase AND table_name = ‘rtc_phototype‘ AND index_name = ‘index_name‘) THEN ALTER TABLE `rtc_Phototype` ADD INDEX index_name ( `imgtype` ); END IF; END// DELIMITER ; CALL schema_change();
mysql判断表字段或索引是否存在,然后修改
标签:hot 判断 The base com ati stat form orm