質問編集履歴

2

文章の修正

2021/02/06 05:30

投稿

Sento__aa
Sento__aa

スコア21

test CHANGED
File without changes
test CHANGED
@@ -478,7 +478,7 @@
478
478
 
479
479
  $table->bigIncrements('id');
480
480
 
481
- $table->integer('employee_id');
481
+ $table->unsignedBigInteger('employee_id');
482
482
 
483
483
  $table->string('uniform');
484
484
 
@@ -520,4 +520,4 @@
520
520
 
521
521
  ## マイグレーション実行時エラー画像
522
522
 
523
- ![イメージ説明](104ac0bcc634b537dd61a088391db821.png)
523
+ ![イメージ説明](872f60283636f906ea9676b747853959.png)

1

文章の変更

2021/02/06 05:30

投稿

Sento__aa
Sento__aa

スコア21

test CHANGED
File without changes
test CHANGED
@@ -389,3 +389,135 @@
389
389
  @endsection
390
390
 
391
391
  ```
392
+
393
+
394
+
395
+
396
+
397
+ # 以下、追加分です
398
+
399
+ ## create_employee_table.php
400
+
401
+ ```ここに言語を入力
402
+
403
+ <?php
404
+
405
+
406
+
407
+ use Illuminate\Database\Migrations\Migration;
408
+
409
+ use Illuminate\Database\Schema\Blueprint;
410
+
411
+ use Illuminate\Support\Facades\Schema;
412
+
413
+
414
+
415
+ class CreateEmployeesTable extends Migration
416
+
417
+ {
418
+
419
+ public function up()
420
+
421
+ {
422
+
423
+ Schema::create('employees', function (Blueprint $table) {
424
+
425
+ $table->bigIncrements('id');
426
+
427
+ $table->integer('employee_id');
428
+
429
+ $table->string('employee_name');
430
+
431
+ $table->string('office');
432
+
433
+ $table->timestamps();
434
+
435
+ });
436
+
437
+ }
438
+
439
+
440
+
441
+ public function down()
442
+
443
+ {
444
+
445
+ Schema::dropIfExists('employees');
446
+
447
+ }
448
+
449
+ }
450
+
451
+ ```
452
+
453
+ ## create_goods_table.php
454
+
455
+ ```ここに言語を入力
456
+
457
+ <?php
458
+
459
+
460
+
461
+ use Illuminate\Database\Migrations\Migration;
462
+
463
+ use Illuminate\Database\Schema\Blueprint;
464
+
465
+ use Illuminate\Support\Facades\Schema;
466
+
467
+
468
+
469
+ class CreateGoodsTable extends Migration
470
+
471
+ {
472
+
473
+ public function up()
474
+
475
+ {
476
+
477
+ Schema::create('goods', function (Blueprint $table) {
478
+
479
+ $table->bigIncrements('id');
480
+
481
+ $table->integer('employee_id');
482
+
483
+ $table->string('uniform');
484
+
485
+ $table->string('winter_clothes');
486
+
487
+ $table->string('shoes');
488
+
489
+ $table->string('other');
490
+
491
+ $table->string('memo');
492
+
493
+ $table->timestamps();
494
+
495
+
496
+
497
+ $table->foreign('employee_id')->references('id')->on('employees')->onDelete('cascade');
498
+
499
+ });
500
+
501
+
502
+
503
+ }
504
+
505
+
506
+
507
+ public function down()
508
+
509
+ {
510
+
511
+ Schema::dropIfExists('goods');
512
+
513
+ }
514
+
515
+ }
516
+
517
+
518
+
519
+ ```
520
+
521
+ ## マイグレーション実行時エラー画像
522
+
523
+ ![イメージ説明](104ac0bcc634b537dd61a088391db821.png)