質問編集履歴
1
情報の追加のため
test
CHANGED
File without changes
|
test
CHANGED
@@ -126,6 +126,98 @@
|
|
126
126
|
|
127
127
|
```
|
128
128
|
|
129
|
+
```create_contents_table.php
|
130
|
+
|
131
|
+
<?php
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
use Illuminate\Database\Migrations\Migration;
|
136
|
+
|
137
|
+
use Illuminate\Database\Schema\Blueprint;
|
138
|
+
|
139
|
+
use Illuminate\Support\Facades\Schema;
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
class CreateContentsTable extends Migration
|
144
|
+
|
145
|
+
{
|
146
|
+
|
147
|
+
/**
|
148
|
+
|
149
|
+
* Run the migrations.
|
150
|
+
|
151
|
+
*
|
152
|
+
|
153
|
+
* @return void
|
154
|
+
|
155
|
+
*/
|
156
|
+
|
157
|
+
public function up()
|
158
|
+
|
159
|
+
{
|
160
|
+
|
161
|
+
Schema::create('contents', function (Blueprint $table) {
|
162
|
+
|
163
|
+
$table->bigIncrements('id');
|
164
|
+
|
165
|
+
$table->unsignedBigInteger('user_id');
|
166
|
+
|
167
|
+
$table->string('title' , 50);
|
168
|
+
|
169
|
+
$table->string('continent');
|
170
|
+
|
171
|
+
$table->string('country');
|
172
|
+
|
173
|
+
$table->string('picture');
|
174
|
+
|
175
|
+
$table->string('content' , 250);
|
176
|
+
|
177
|
+
$table->integer('costs');
|
178
|
+
|
179
|
+
$table->integer('span');
|
180
|
+
|
181
|
+
$table->timestamps();
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
//外部キー制約
|
186
|
+
|
187
|
+
$table->foreign('user_id')->references('id')->on('users');
|
188
|
+
|
189
|
+
});
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
}
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
/**
|
198
|
+
|
199
|
+
* Reverse the migrations.
|
200
|
+
|
201
|
+
*
|
202
|
+
|
203
|
+
* @return void
|
204
|
+
|
205
|
+
*/
|
206
|
+
|
207
|
+
public function down()
|
208
|
+
|
209
|
+
{
|
210
|
+
|
211
|
+
Schema::dropIfExists('contents');
|
212
|
+
|
213
|
+
}
|
214
|
+
|
215
|
+
}
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
```
|
220
|
+
|
129
221
|
|
130
222
|
|
131
223
|
### 試したこと
|