Created
March 25, 2014 06:49
-
-
Save anytizer/9756383 to your computer and use it in GitHub Desktop.
Bring triggers from your system base into databas tables.
This file contains hidden or 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
SELECT trigger_name FROM information_schema.triggers WHERE trigger_schema = DATABASE(); | |
-- Issues with NULL fields - accept NULLs | |
DROP TABLE IF EXISTS system_triggers_all; | |
CREATE TABLE `system_triggers_all` ( | |
`trigger_name` VARCHAR(255) DEFAULT '', | |
`event_object_schema` VARCHAR(255) DEFAULT '', | |
`event_object_table` VARCHAR(255) DEFAULT '', | |
`event_manipulation` VARCHAR(255) DEFAULT '', | |
`action_orientation` VARCHAR(255) DEFAULT '', | |
`action_timing` VARCHAR(255) DEFAULT '', | |
`action_reference_old_table` VARCHAR(255) DEFAULT '', | |
`action_reference_new_table` VARCHAR(255) DEFAULT '', | |
`action_reference_old_row` VARCHAR(255) DEFAULT '', | |
`action_reference_new_row` VARCHAR(255) DEFAULT '', | |
`created` DATETIME, | |
`action_statement` LONGTEXT | |
) ENGINE=MYISAM DEFAULT CHARSET=utf8; | |
-- CREATE TABLE system_triggers_all | |
INSERT INTO system_triggers_all | |
SELECT | |
trigger_name, | |
event_object_schema, | |
event_object_table, | |
event_manipulation, | |
action_orientation, | |
action_timing, | |
action_reference_old_table, | |
action_reference_new_table, | |
action_reference_old_row, | |
action_reference_new_row, | |
created, | |
action_statement | |
FROM information_schema.triggers | |
WHERE | |
event_object_schema = DATABASE() | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment