質問編集履歴
1
マイグレーションファイルの内容を追記しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -37,6 +37,50 @@
|
|
37
37
|
Please use the argument -v to see more details.
|
38
38
|
```
|
39
39
|
|
40
|
+
※追記
|
41
|
+
マイグレーションファイルはこちらです。[記事](https://qiita.com/sano1202/items/6021856b70e4f8d3dc3d#1%E3%83%9E%E3%82%A4%E3%82%B0%E3%83%AC%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%81%AE%E4%BD%9C%E6%88%90)に従って`php artisan make:migration create_books_table --create=books`で作成しました。
|
42
|
+
|
43
|
+
```
|
44
|
+
<?php
|
45
|
+
|
46
|
+
use Illuminate\Support\Facades\Schema;
|
47
|
+
use Illuminate\Database\Schema\Blueprint;
|
48
|
+
use Illuminate\Database\Migrations\Migration;
|
49
|
+
|
50
|
+
class CreateBooksTable extends Migration
|
51
|
+
{
|
52
|
+
/**
|
53
|
+
* Run the migrations.
|
54
|
+
*
|
55
|
+
* @return void
|
56
|
+
*/
|
57
|
+
public function up()
|
58
|
+
{
|
59
|
+
Schema::create('books', function (Blueprint $table) {
|
60
|
+
$table->bigIncrements('id');
|
61
|
+
$table->string('name', 50);
|
62
|
+
$table->integer('price');
|
63
|
+
$table->string('author', 50)->nullable();
|
64
|
+
$table->timestamps();
|
65
|
+
});
|
66
|
+
// Schema::create('books', function (Blueprint $table) {
|
67
|
+
// $table->bigIncrements('id');
|
68
|
+
// $table->timestamps();
|
69
|
+
// });
|
70
|
+
}
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Reverse the migrations.
|
74
|
+
*
|
75
|
+
* @return void
|
76
|
+
*/
|
77
|
+
public function down()
|
78
|
+
{
|
79
|
+
Schema::dropIfExists('books');
|
80
|
+
}
|
81
|
+
}
|
82
|
+
```
|
83
|
+
|
40
84
|
### 試したこと
|
41
85
|
現状、.envファイルのDB部分は、下記のようになっております。
|
42
86
|
```
|