I want to create triggers in my table.I am using Data Grip as an interface to connect to my database.I googled around and the documentation said that it had something like a "Generate" drop down list which has something like function and procedures templates available for creation.But I get no such drop down list and even when I go to the new option after right clicking a table,I don't get an option for functions or procedures. I am using DataGrip 2017.1.2 and a MySQL data source.
Asked
Active
Viewed 1.3k times
2 Answers
9
As an alternative to @Andrew 's answer (since 2016.3 or .2), you can:
- Open database console
- Press Alt+Ins (Cmd+N on Mac)
- "Generate" menu will pop up
- Select "Trigger"
- A "live template" will start
- Type trigger name...Enter
- Type table name...Enter
- ...
- Execute resulting script with Ctrl+Enter

kassak
- 3,974
- 1
- 25
- 36
3
If nothing else, you could begin writing a CREATE TRIGGER statement and let DataGrip's code completion help you along the way.
In DataGrip, either Open Console (Ctrl+Shift+F10), or right-click your table name and choose New > Console File, to open a window where you can begin typing "CREATE TRIGGER", and go from there.
The 23.3 Using Triggers page in the MySQL manual and its 23.3.1 Trigger Syntax and Examples linked page are useful references.

Keshan Nageswaran
- 8,060
- 3
- 28
- 45

Andrew
- 585
- 4
- 17