1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-27 02:06:52 +00:00
pixelfed/database/migrations/2019_01_12_054413_stories.php

73 lines
2.6 KiB
PHP
Raw Normal View History

2019-01-12 07:41:23 +00:00
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class Stories extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('story_items', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('story_id')->unsigned()->index();
$table->string('media_path')->nullable();
$table->string('media_url')->nullable();
$table->tinyInteger('duration')->unsigned();
$table->string('filter')->nullable();
$table->string('link_url')->nullable()->index();
$table->string('link_text')->nullable();
$table->tinyInteger('order')->unsigned()->nullable();
$table->string('type')->default('photo');
$table->json('layers')->nullable();
$table->timestamp('expires_at')->nullable();
$table->timestamps();
});
Schema::create('story_views', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('story_id')->unsigned()->index();
$table->bigInteger('profile_id')->unsigned()->index();
$table->unique(['story_id', 'profile_id']);
$table->timestamps();
});
Schema::table('stories', function (Blueprint $table) {
$table->string('title')->nullable()->after('profile_id');
$table->boolean('preview_photo')->default(false)->after('title');
$table->boolean('local_only')->default(false)->after('preview_photo');
$table->boolean('is_live')->default(false)->after('local_only');
$table->string('broadcast_url')->nullable()->after('is_live');
$table->string('broadcast_key')->nullable()->after('broadcast_url');
});
Schema::table('story_reactions', function (Blueprint $table) {
$table->bigInteger('story_id')->unsigned()->index()->after('profile_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('story_items');
Schema::dropIfExists('story_views');
Schema::table('stories', function (Blueprint $table) {
2021-06-01 05:26:40 +00:00
$table->dropColumn(['title','preview_photo','local_only','is_live','broadcast_url','broadcast_key']);
2019-01-12 07:41:23 +00:00
});
Schema::table('story_reactions', function (Blueprint $table) {
$table->dropColumn('story_id');
});
}
}