|
@@ -15,7 +15,18 @@ class CreatePostsTable extends Migration
|
|
|
{
|
|
|
Schema::create('posts', function (Blueprint $table) {
|
|
|
$table->id();
|
|
|
+ $table->unsignedBigInteger('category_id');
|
|
|
+ $table->unsignedBigInteger('user_id');
|
|
|
+
|
|
|
+ $table->string('title');
|
|
|
+ $table->string('anons');
|
|
|
+ $table->text('body');
|
|
|
+ $table->string('thumbnail');
|
|
|
+
|
|
|
$table->timestamps();
|
|
|
+
|
|
|
+ $table->foreign('category_id')->on('post_categories')->references('id')->onDelete('cascade');
|
|
|
+ $table->foreign('user_id')->on('users')->references('id')->onDelete('cascade');
|
|
|
});
|
|
|
}
|
|
|
|