aboutsummaryrefslogtreecommitdiffhomepage
path: root/database/migrations/2018_08_22_102141_create_posts_table.php
diff options
context:
space:
mode:
Diffstat (limited to 'database/migrations/2018_08_22_102141_create_posts_table.php')
-rw-r--r--database/migrations/2018_08_22_102141_create_posts_table.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/database/migrations/2018_08_22_102141_create_posts_table.php b/database/migrations/2018_08_22_102141_create_posts_table.php
new file mode 100644
index 0000000..6154ca8
--- /dev/null
+++ b/database/migrations/2018_08_22_102141_create_posts_table.php
@@ -0,0 +1,41 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreatePostsTable extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Schema::create('posts', function (Blueprint $table) {
+ $table->increments('id');
+ $table->integer('post_types_id')->unsigned();
+ $table->integer('user_id')->unsigned();
+ $table->timestamps();
+
+ $table->foreign('user_id')
+ ->references('id')
+ ->on('users');
+
+ $table->foreign('post_types_id')
+ ->references('id')
+ ->on('post_types');
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::drop('posts');
+ }
+}