Add new migrations

This commit is contained in:
Daniel Supernault 2018-10-09 19:15:17 -06:00
parent 45a48270d6
commit 4794182334
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
6 changed files with 205 additions and 0 deletions

View file

@ -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');
}
}

View file

@ -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');
}
}

View file

@ -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');
}
}

View file

@ -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');
}
}

View file

@ -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');
}
}

View file

@ -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()
{
//
}
}