質問編集履歴
1
マイグレーションのファイルです
test
CHANGED
File without changes
|
test
CHANGED
@@ -328,6 +328,160 @@
|
|
328
328
|
|
329
329
|
|
330
330
|
|
331
|
+
```ここに言語を入力
|
332
|
+
|
333
|
+
<?php
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
use Illuminate\Support\Facades\Schema;
|
338
|
+
|
339
|
+
use Illuminate\Database\Schema\Blueprint;
|
340
|
+
|
341
|
+
use Illuminate\Database\Migrations\Migration;
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
class CreateMainTasksTable extends Migration
|
346
|
+
|
347
|
+
{
|
348
|
+
|
349
|
+
/**
|
350
|
+
|
351
|
+
* Run the migrations.
|
352
|
+
|
353
|
+
*
|
354
|
+
|
355
|
+
* @return void
|
356
|
+
|
357
|
+
*/
|
358
|
+
|
359
|
+
public function up()
|
360
|
+
|
361
|
+
{
|
362
|
+
|
363
|
+
Schema::create('main_tasks', function (Blueprint $table) {
|
364
|
+
|
365
|
+
$table->increments('id');
|
366
|
+
|
367
|
+
$table->string('title', 20);
|
368
|
+
|
369
|
+
$table->timestamps();
|
370
|
+
|
371
|
+
});
|
372
|
+
|
373
|
+
}
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
/**
|
378
|
+
|
379
|
+
* Reverse the migrations.
|
380
|
+
|
381
|
+
*
|
382
|
+
|
383
|
+
* @return void
|
384
|
+
|
385
|
+
*/
|
386
|
+
|
387
|
+
public function down()
|
388
|
+
|
389
|
+
{
|
390
|
+
|
391
|
+
Schema::dropIfExists('main_tasks');
|
392
|
+
|
393
|
+
}
|
394
|
+
|
395
|
+
}
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
```
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
```ここに言語を入力
|
406
|
+
|
407
|
+
<?php
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
use Illuminate\Support\Facades\Schema;
|
412
|
+
|
413
|
+
use Illuminate\Database\Schema\Blueprint;
|
414
|
+
|
415
|
+
use Illuminate\Database\Migrations\Migration;
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
class CreateTaskstable extends Migration
|
420
|
+
|
421
|
+
{
|
422
|
+
|
423
|
+
/**
|
424
|
+
|
425
|
+
* Run the migrations.
|
426
|
+
|
427
|
+
*
|
428
|
+
|
429
|
+
* @return void
|
430
|
+
|
431
|
+
*/
|
432
|
+
|
433
|
+
public function up()
|
434
|
+
|
435
|
+
{
|
436
|
+
|
437
|
+
Schema::create('tasks', function (Blueprint $table) {
|
438
|
+
|
439
|
+
$table->increments('id');
|
440
|
+
|
441
|
+
$table->integer('main_task_id')->unsigned();
|
442
|
+
|
443
|
+
$table->string('title', 100);
|
444
|
+
|
445
|
+
$table->date('due_date');
|
446
|
+
|
447
|
+
$table->integer('status')->default(1);
|
448
|
+
|
449
|
+
$table->timestamps();
|
450
|
+
|
451
|
+
|
452
|
+
|
453
|
+
// 外部キーを設定する
|
454
|
+
|
455
|
+
$table->foreign('main_task_id')->references('id')->on('main_tasks');
|
456
|
+
|
457
|
+
});
|
458
|
+
|
459
|
+
}
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
/**
|
464
|
+
|
465
|
+
* Reverse the migrations.
|
466
|
+
|
467
|
+
*
|
468
|
+
|
469
|
+
* @return void
|
470
|
+
|
471
|
+
*/
|
472
|
+
|
473
|
+
public function down()
|
474
|
+
|
475
|
+
{
|
476
|
+
|
477
|
+
Schema::dropIfExists('tasks');
|
478
|
+
|
479
|
+
}
|
480
|
+
|
481
|
+
}
|
482
|
+
|
483
|
+
```
|
484
|
+
|
331
485
|
|
332
486
|
|
333
487
|
|