- Notifications
You must be signed in to change notification settings - Fork27
Commit481b94a
authored
Dump TRIGGER definitions _after_ data (#100)
When the new CSV output mode with the concept of "output drivers" was added in#92, dumping `TRIGGER` definitions was made an implementation detail of the MySQL output driver. This caused `TRIGGER` definitions to be dumped right after the `CREATE TABLE ...` commands, before the actual data `INSERT` statements.This potentially breaks the generated SQL files, since a newly created trigger may be relevant for the subsequent `INSERT` statements; however, MySQL requires that tables used in the trigger are also included in the `LOCK TABLES` statements.The aim of this PR is to revert that change, i. e. to dump trigger definitions for a table _after_ the data insert statements for it.I think it is not necessary to move all trigger definitions to the very end of the output – that is, after _all_ tables have been created and filled with data: A trigger depends on insert/update/deletes for a particular table and is executed only on these events. So, it is not a problem if a trigger refers to a table that has not been created/loaded yet as long as the trigger is not run (and avoiding to run it is the aim of this PR).1 parent000e2df commit481b94a
File tree
4 files changed
+22
-8
lines changed- src/Webfactory/Slimdump/Database
4 files changed
+22
-8
lines changedLines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
78 | 82 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
80 | 84 | | |
81 | 85 | | |
82 | 86 | | |
83 | 87 | | |
84 | 88 | | |
85 | 89 | | |
86 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
87 | 96 | | |
88 | 97 | | |
89 | 98 | | |
| |||
Lines changed: 4 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | 63 | | |
68 | 64 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
| 65 | + | |
73 | 66 | | |
| 67 | + | |
| 68 | + | |
74 | 69 | | |
75 | 70 | | |
76 | 71 | | |
77 | 72 | | |
78 | 73 | | |
79 | 74 | | |
| 75 | + | |
80 | 76 | | |
81 | 77 | | |
82 | 78 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
30 | 35 | | |
31 | 36 | | |
32 | 37 | | |
| |||
0 commit comments
Comments
(0)