質問編集履歴

2

改行

2020/11/13 15:55

投稿

shinichi_mori
shinichi_mori

スコア0

test CHANGED
File without changes
test CHANGED
@@ -86,7 +86,71 @@
86
86
 
87
87
  ```items
88
88
 
89
- use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class CreateItemsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('items', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('name', 50)->nullable(false); $table->integer('price')->nullable(false); $table->text('introduction')->nullable(false); $table->integer('stock_amount')->nullable(false); $table->integer('buy_amount')->nullable(false); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('items'); }
89
+ use Illuminate\Database\Migrations\Migration;
90
+
91
+ use Illuminate\Database\Schema\Blueprint;
92
+
93
+ use Illuminate\Support\Facades\Schema;
94
+
95
+
96
+
97
+ class CreateItemsTable extends Migration
98
+
99
+ {
100
+
101
+ /**
102
+
103
+ * Run the migrations.
104
+
105
+ *
106
+
107
+ * @return void
108
+
109
+ */
110
+
111
+ public function up()
112
+
113
+ {
114
+
115
+ Schema::create('items', function (Blueprint $table) {
116
+
117
+ $table->bigIncrements('id');
118
+
119
+ $table->string('name', 50)->nullable(false);
120
+
121
+ $table->integer('price')->nullable(false);
122
+
123
+ $table->text('introduction')->nullable(false);
124
+
125
+ $table->integer('stock_amount')->nullable(false);
126
+
127
+ $table->integer('buy_amount')->nullable(false);
128
+
129
+ $table->timestamps();
130
+
131
+ });
132
+
133
+ }
134
+
135
+
136
+
137
+ /**
138
+
139
+ * Reverse the migrations.
140
+
141
+ *
142
+
143
+ * @return void
144
+
145
+ */
146
+
147
+ public function down()
148
+
149
+ {
150
+
151
+ Schema::dropIfExists('items');
152
+
153
+ }
90
154
 
91
155
  ```
92
156
 
@@ -94,7 +158,65 @@
94
158
 
95
159
  ```carts
96
160
 
97
- use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class CreateCartsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('carts', function (Blueprint $table) { $table->bigIncrements('id'); $table->integer('item_id'); $table->integer('user_id'); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('carts'); }
161
+ use Illuminate\Database\Migrations\Migration;
162
+
163
+ use Illuminate\Database\Schema\Blueprint;
164
+
165
+ use Illuminate\Support\Facades\Schema;
166
+
167
+
168
+
169
+ class CreateCartsTable extends Migration
170
+
171
+ {
172
+
173
+ /**
174
+
175
+ * Run the migrations.
176
+
177
+ *
178
+
179
+ * @return void
180
+
181
+ */
182
+
183
+ public function up()
184
+
185
+ {
186
+
187
+ Schema::create('carts', function (Blueprint $table) {
188
+
189
+ $table->bigIncrements('id');
190
+
191
+ $table->integer('item_id');
192
+
193
+ $table->integer('user_id');
194
+
195
+ $table->timestamps();
196
+
197
+ });
198
+
199
+ }
200
+
201
+
202
+
203
+ /**
204
+
205
+ * Reverse the migrations.
206
+
207
+ *
208
+
209
+ * @return void
210
+
211
+ */
212
+
213
+ public function down()
214
+
215
+ {
216
+
217
+ Schema::dropIfExists('carts');
218
+
219
+ }
98
220
 
99
221
  ```
100
222
 
@@ -102,7 +224,65 @@
102
224
 
103
225
  ```items追加分
104
226
 
105
- use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class AddImgpathToItemsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('items', function (Blueprint $table) { // $table->string('imgpath', '200')->nullable(false); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('items', function (Blueprint $table) { // }); }
227
+ use Illuminate\Database\Migrations\Migration;
228
+
229
+ use Illuminate\Database\Schema\Blueprint;
230
+
231
+ use Illuminate\Support\Facades\Schema;
232
+
233
+
234
+
235
+ class AddImgpathToItemsTable extends Migration
236
+
237
+ {
238
+
239
+ /**
240
+
241
+ * Run the migrations.
242
+
243
+ *
244
+
245
+ * @return void
246
+
247
+ */
248
+
249
+ public function up()
250
+
251
+ {
252
+
253
+ Schema::table('items', function (Blueprint $table) {
254
+
255
+ //
256
+
257
+ $table->string('imgpath', '200')->nullable(false);
258
+
259
+ });
260
+
261
+ }
262
+
263
+
264
+
265
+ /**
266
+
267
+ * Reverse the migrations.
268
+
269
+ *
270
+
271
+ * @return void
272
+
273
+ */
274
+
275
+ public function down()
276
+
277
+ {
278
+
279
+ Schema::table('items', function (Blueprint $table) {
280
+
281
+ //
282
+
283
+ });
284
+
285
+ }
106
286
 
107
287
  ```
108
288
 
@@ -110,7 +290,65 @@
110
290
 
111
291
  ```items追加分
112
292
 
113
- use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class AddStockToItemsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('items', function (Blueprint $table) { // $table->integer('stock')->nullable(false); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('items', function (Blueprint $table) { // }); }
293
+ use Illuminate\Database\Migrations\Migration;
294
+
295
+ use Illuminate\Database\Schema\Blueprint;
296
+
297
+ use Illuminate\Support\Facades\Schema;
298
+
299
+
300
+
301
+ class AddStockToItemsTable extends Migration
302
+
303
+ {
304
+
305
+ /**
306
+
307
+ * Run the migrations.
308
+
309
+ *
310
+
311
+ * @return void
312
+
313
+ */
314
+
315
+ public function up()
316
+
317
+ {
318
+
319
+ Schema::table('items', function (Blueprint $table) {
320
+
321
+ //
322
+
323
+ $table->integer('stock')->nullable(false);
324
+
325
+ });
326
+
327
+ }
328
+
329
+
330
+
331
+ /**
332
+
333
+ * Reverse the migrations.
334
+
335
+ *
336
+
337
+ * @return void
338
+
339
+ */
340
+
341
+ public function down()
342
+
343
+ {
344
+
345
+ Schema::table('items', function (Blueprint $table) {
346
+
347
+ //
348
+
349
+ });
350
+
351
+ }
114
352
 
115
353
  ```
116
354
 

1

新しいコードを追加

2020/11/13 15:55

投稿

shinichi_mori
shinichi_mori

スコア0

test CHANGED
File without changes
test CHANGED
@@ -80,6 +80,46 @@
80
80
 
81
81
 
82
82
 
83
+ ###マイグレーションファイル
84
+
85
+
86
+
87
+ ```items
88
+
89
+ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class CreateItemsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('items', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('name', 50)->nullable(false); $table->integer('price')->nullable(false); $table->text('introduction')->nullable(false); $table->integer('stock_amount')->nullable(false); $table->integer('buy_amount')->nullable(false); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('items'); }
90
+
91
+ ```
92
+
93
+
94
+
95
+ ```carts
96
+
97
+ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class CreateCartsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('carts', function (Blueprint $table) { $table->bigIncrements('id'); $table->integer('item_id'); $table->integer('user_id'); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('carts'); }
98
+
99
+ ```
100
+
101
+
102
+
103
+ ```items追加分
104
+
105
+ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class AddImgpathToItemsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('items', function (Blueprint $table) { // $table->string('imgpath', '200')->nullable(false); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('items', function (Blueprint $table) { // }); }
106
+
107
+ ```
108
+
109
+
110
+
111
+ ```items追加分
112
+
113
+ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class AddStockToItemsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('items', function (Blueprint $table) { // $table->integer('stock')->nullable(false); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('items', function (Blueprint $table) { // }); }
114
+
115
+ ```
116
+
117
+
118
+
119
+
120
+
121
+
122
+
83
123
  ### 試したこと
84
124
 
85
125