Skip to content

Commit f4f8be5

Browse files
Fix cascade deletetion of signed off wines
Fixes #255 Signed-off-by: Christoph Wurst <[email protected]>
1 parent 9d92e97 commit f4f8be5

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\Schema;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Database\Migrations\Migration;
6+
7+
class CascadeDeleteSignedOffWines extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
17+
Schema::table('wines_chosen_signed_off', function (Blueprint $table) {
18+
$table->dropForeign('wines_chosen_signed_off_competition_id_foreign');
19+
$table->foreign('competition_id')
20+
->references('id')
21+
->on('competition')
22+
->onDelete('cascade')
23+
->onUpdate('cascade');
24+
});
25+
}
26+
27+
/**
28+
* Reverse the migrations.
29+
*
30+
* @return void
31+
*/
32+
public function down()
33+
{
34+
Schema::table('wines_chosen_signed_off', function (Blueprint $table) {
35+
$table->dropForeign('wines_chosen_signed_off_competition_id_foreign');
36+
$table->foreign('competition_id')
37+
->references('id')
38+
->on('competition')
39+
->onDelete('no action')
40+
->onUpdate('cascade');
41+
});
42+
}
43+
}

0 commit comments

Comments
 (0)