質問編集履歴
1
マイグレーションファイルの内容を追記しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -76,6 +76,94 @@
|
|
76
76
|
|
77
77
|
|
78
78
|
|
79
|
+
※追記
|
80
|
+
|
81
|
+
マイグレーションファイルはこちらです。[記事](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`で作成しました。
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
```
|
86
|
+
|
87
|
+
<?php
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
use Illuminate\Support\Facades\Schema;
|
92
|
+
|
93
|
+
use Illuminate\Database\Schema\Blueprint;
|
94
|
+
|
95
|
+
use Illuminate\Database\Migrations\Migration;
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
class CreateBooksTable extends Migration
|
100
|
+
|
101
|
+
{
|
102
|
+
|
103
|
+
/**
|
104
|
+
|
105
|
+
* Run the migrations.
|
106
|
+
|
107
|
+
*
|
108
|
+
|
109
|
+
* @return void
|
110
|
+
|
111
|
+
*/
|
112
|
+
|
113
|
+
public function up()
|
114
|
+
|
115
|
+
{
|
116
|
+
|
117
|
+
Schema::create('books', function (Blueprint $table) {
|
118
|
+
|
119
|
+
$table->bigIncrements('id');
|
120
|
+
|
121
|
+
$table->string('name', 50);
|
122
|
+
|
123
|
+
$table->integer('price');
|
124
|
+
|
125
|
+
$table->string('author', 50)->nullable();
|
126
|
+
|
127
|
+
$table->timestamps();
|
128
|
+
|
129
|
+
});
|
130
|
+
|
131
|
+
// Schema::create('books', function (Blueprint $table) {
|
132
|
+
|
133
|
+
// $table->bigIncrements('id');
|
134
|
+
|
135
|
+
// $table->timestamps();
|
136
|
+
|
137
|
+
// });
|
138
|
+
|
139
|
+
}
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
/**
|
144
|
+
|
145
|
+
* Reverse the migrations.
|
146
|
+
|
147
|
+
*
|
148
|
+
|
149
|
+
* @return void
|
150
|
+
|
151
|
+
*/
|
152
|
+
|
153
|
+
public function down()
|
154
|
+
|
155
|
+
{
|
156
|
+
|
157
|
+
Schema::dropIfExists('books');
|
158
|
+
|
159
|
+
}
|
160
|
+
|
161
|
+
}
|
162
|
+
|
163
|
+
```
|
164
|
+
|
165
|
+
|
166
|
+
|
79
167
|
### 試したこと
|
80
168
|
|
81
169
|
現状、.envファイルのDB部分は、下記のようになっております。
|