Skip to content

Commit

Permalink
nullOnDelete() method
Browse files Browse the repository at this point in the history
  • Loading branch information
sdebacker committed May 27, 2022
1 parent 912d6cd commit 9a162d6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion database/migrations/create_events_table.php.stub
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CreateEventsTable extends Migration
$table->date('start_date');
$table->date('end_date');
$table->boolean('registration_form');
$table->foreignId('image_id')->nullable();
$table->foreignId('image_id')->nullable()->constrained('files')->nullOnDelete();
$table->json('status')->default(new Expression('(JSON_OBJECT())'));
$table->json('title')->default(new Expression('(JSON_OBJECT())'));
$table->json('slug')->default(new Expression('(JSON_OBJECT())'));
Expand Down
2 changes: 1 addition & 1 deletion database/migrations/create_registrations_table.php.stub
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CreateRegistrationsTable extends Migration
Schema::create('registrations', function (Blueprint $table) {
$table->id();
$table->foreignId('event_id')->constrained();
$table->foreignId('user_id')->nullable();
$table->foreignId('user_id')->nullable()->constrained()->nullOnDelete();
$table->unsignedInteger('number_of_people');
$table->string('email')->nullable();
$table->string('first_name')->nullable();
Expand Down

0 comments on commit 9a162d6

Please sign in to comment.