浏览代码

Add new migrations

Daniel Supernault 6 年之前
父节点
当前提交
4794182334

+ 34 - 0
database/migrations/2018_09_19_060554_create_stories_table.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateStoriesTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('stories', function (Blueprint $table) {
+            $table->increments('bigIncrements');
+            $table->bigInteger('profile_id')->unsigned();
+            $table->timestamp('published_at')->nullable();
+            $table->timestamp('expires_at')->nullable();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('stories');
+    }
+}

+ 33 - 0
database/migrations/2018_09_19_060611_create_story_reactions_table.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateStoryReactionsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('story_reactions', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->bigInteger('profile_id')->unsigned()->nullable();
+            $table->string('reaction')->index();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('story_reactions');
+    }
+}

+ 37 - 0
database/migrations/2018_09_27_040314_create_collections_table.php

@@ -0,0 +1,37 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateCollectionsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('collections', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->bigInteger('profile_id')->unsigned()->nullable();
+            $table->string('title')->nullable();
+            $table->text('description')->nullable();
+            $table->boolean('is_nsfw')->default(false);
+            $table->string('visibility')->default('public')->index();
+            $table->timestamp('published_at')->nullable();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('collections');
+    }
+}

+ 38 - 0
database/migrations/2018_09_30_051108_create_direct_messages_table.php

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateDirectMessagesTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('direct_messages', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->bigInteger('to_id')->unsigned()->index();
+            $table->bigInteger('from_id')->unsigned()->index();
+            $table->string('from_profile_ids')->nullable();
+            $table->boolean('group_message')->default(false);
+            $table->bigInteger('status_id')->unsigned()->integer();
+            $table->unique(['to_id', 'from_id', 'status_id']);
+            $table->timestamp('read_at')->nullable();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('direct_messages');
+    }
+}

+ 35 - 0
database/migrations/2018_10_02_040917_create_collection_items_table.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateCollectionItemsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('collection_items', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->bigInteger('collection_id')->unsigned()->index();
+            $table->unsignedInteger('order')->nullable();
+            $table->string('object_type')->default('post')->index();
+            $table->bigInteger('object_id')->unsigned()->index();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('collection_items');
+    }
+}

+ 28 - 0
database/migrations/2018_10_09_043717_update_status_visibility_defaults.php

@@ -0,0 +1,28 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class UpdateStatusVisibilityDefaults extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        DB::statement("ALTER TABLE statuses CHANGE COLUMN visibility visibility ENUM('public','unlisted','private','direct', 'draft') NOT NULL DEFAULT 'public'");
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        //
+    }
+}