This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Temporarily change delimiter to $$ | |
DELIMITER $$ | |
-- Drop procedure if it exists | |
DROP PROCEDURE IF EXISTS drop_pk_if_exists $$ | |
-- Begin create procedure | |
CREATE PROCEDURE drop_pk_if_exists () BEGIN | |
-- If my_table has a primary key | |
IF EXISTS(select * from `information_schema`.`table_constraints` | |
where `constraint_schema` = database() | |
and `constraint_type` = "PRIMARY KEY" |