File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -136,7 +136,14 @@ private function prepareMigrationText()
136
136
if ($ functionName == 'foreign ' ) {
137
137
$ foreignTable = array_shift ($ inputParams );
138
138
$ foreignField = array_shift ($ inputParams );
139
- $ this ->foreignKeyText .= "\$table->foreign(' " .$ this ->name ."')->references(' " .$ foreignField ."')->on(' " .$ foreignTable ."'); " ;
139
+ $ this ->foreignKeyText .= "\$table->foreign(' " .$ this ->name ."')->references(' " .$ foreignField ."')->on(' " .$ foreignTable ."') " ;
140
+ if (count ($ inputParams )) {
141
+ $ cascade = array_shift ($ inputParams );
142
+ if ($ cascade == 'cascade ' ) {
143
+ $ this ->foreignKeyText .= "->onUpdate('cascade')->onDelete('cascade') " ;
144
+ }
145
+ }
146
+ $ this ->foreignKeyText .= "; " ;
140
147
} else {
141
148
$ this ->migrationText .= '-> ' .$ functionName ;
142
149
$ this ->migrationText .= '( ' ;
You can’t perform that action at this time.
0 commit comments