mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 06:21:27 +00:00
Add story migrations
This commit is contained in:
parent
c456fa7ef1
commit
250d19e40b
1 changed files with 77 additions and 0 deletions
77
database/migrations/2019_01_12_054413_stories.php
Normal file
77
database/migrations/2019_01_12_054413_stories.php
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
<?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) {
|
||||||
|
$table->dropColumn('title');
|
||||||
|
$table->dropColumn('preview_photo');
|
||||||
|
$table->dropColumn('local_only');
|
||||||
|
$table->dropColumn('is_live');
|
||||||
|
$table->dropColumn('broadcast_url');
|
||||||
|
$table->dropColumn('broadcast_key');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('story_reactions', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('story_id');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue