質問編集履歴
3
文字の修正
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Laravel6
|
1
|
+
Laravel6 中間テーブルの作成でマイグレーションが上手くいかない
|
test
CHANGED
@@ -2,10 +2,6 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
マイグレーションを成功させたい。
|
6
|
-
|
7
|
-
|
8
|
-
|
9
5
|
お気に入り登録機能を作成中で,
|
10
6
|
|
11
7
|
中間テーブルの作成を行おうとマイグレーションを行ったですが上手く実行されませんでした。
|
2
文字の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -198,7 +198,7 @@
|
|
198
198
|
|
199
199
|
{
|
200
200
|
|
201
|
-
Schema::create('item
|
201
|
+
Schema::create('item', function (Blueprint $table) {
|
202
202
|
|
203
203
|
$table->bigIncrements('id');
|
204
204
|
|
1
文字の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -180,6 +180,84 @@
|
|
180
180
|
|
181
181
|
|
182
182
|
|
183
|
+
class ItemTable extends Migration
|
184
|
+
|
185
|
+
{
|
186
|
+
|
187
|
+
/**
|
188
|
+
|
189
|
+
* Run the migrations.
|
190
|
+
|
191
|
+
*
|
192
|
+
|
193
|
+
* @return void
|
194
|
+
|
195
|
+
*/
|
196
|
+
|
197
|
+
public function up()
|
198
|
+
|
199
|
+
{
|
200
|
+
|
201
|
+
Schema::create('items', function (Blueprint $table) {
|
202
|
+
|
203
|
+
$table->bigIncrements('id');
|
204
|
+
|
205
|
+
$table->string('name')->unique();
|
206
|
+
|
207
|
+
$table->timestamps();
|
208
|
+
|
209
|
+
});
|
210
|
+
|
211
|
+
}
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
/**
|
216
|
+
|
217
|
+
* Reverse the migrations.
|
218
|
+
|
219
|
+
*
|
220
|
+
|
221
|
+
* @return void
|
222
|
+
|
223
|
+
*/
|
224
|
+
|
225
|
+
public function down()
|
226
|
+
|
227
|
+
{
|
228
|
+
|
229
|
+
Schema::dropIfExists('item');
|
230
|
+
|
231
|
+
}
|
232
|
+
|
233
|
+
}
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
```
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
2021_02_23_041959_create__item_user_table.php
|
246
|
+
|
247
|
+
```
|
248
|
+
|
249
|
+
<?php
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
use Illuminate\Database\Migrations\Migration;
|
254
|
+
|
255
|
+
use Illuminate\Database\Schema\Blueprint;
|
256
|
+
|
257
|
+
use Illuminate\Support\Facades\Schema;
|
258
|
+
|
259
|
+
|
260
|
+
|
183
261
|
class UserItemTable extends Migration
|
184
262
|
|
185
263
|
{
|
@@ -236,86 +314,6 @@
|
|
236
314
|
|
237
315
|
|
238
316
|
|
239
|
-
|
240
|
-
|
241
|
-
```
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
2021_02_23_041959_create__item_user_table.php
|
248
|
-
|
249
|
-
```
|
250
|
-
|
251
|
-
<?php
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
use Illuminate\Database\Migrations\Migration;
|
256
|
-
|
257
|
-
use Illuminate\Database\Schema\Blueprint;
|
258
|
-
|
259
|
-
use Illuminate\Support\Facades\Schema;
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
class UserItemTable extends Migration
|
264
|
-
|
265
|
-
{
|
266
|
-
|
267
|
-
/**
|
268
|
-
|
269
|
-
* Run the migrations.
|
270
|
-
|
271
|
-
*
|
272
|
-
|
273
|
-
* @return void
|
274
|
-
|
275
|
-
*/
|
276
|
-
|
277
|
-
public function up()
|
278
|
-
|
279
|
-
{
|
280
|
-
|
281
|
-
Schema::create('item_user', function (Blueprint $table) {
|
282
|
-
|
283
|
-
$table->bigIncrements('id');
|
284
|
-
|
285
|
-
$table->integer('user_id');
|
286
|
-
|
287
|
-
$table->integer('item_id');
|
288
|
-
|
289
|
-
$table->timestamps();
|
290
|
-
|
291
|
-
});
|
292
|
-
|
293
|
-
}
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
/**
|
298
|
-
|
299
|
-
* Reverse the migrations.
|
300
|
-
|
301
|
-
*
|
302
|
-
|
303
|
-
* @return void
|
304
|
-
|
305
|
-
*/
|
306
|
-
|
307
|
-
public function down()
|
308
|
-
|
309
|
-
{
|
310
|
-
|
311
|
-
//
|
312
|
-
|
313
|
-
}
|
314
|
-
|
315
|
-
}
|
316
|
-
|
317
|
-
|
318
|
-
|
319
317
|
```
|
320
318
|
|
321
319
|
|