From a6b7898d982dcef1a2ddf456b4948856ee1728b7 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 23 Dec 2018 19:07:49 -0700 Subject: [PATCH 1/3] Update Status model --- app/Status.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Status.php b/app/Status.php index e9c40ca5f..73b343825 100644 --- a/app/Status.php +++ b/app/Status.php @@ -19,7 +19,7 @@ class Status extends Model */ protected $dates = ['deleted_at']; - protected $fillable = ['profile_id', 'visibility', 'in_reply_to_id', 'reblog_of_id']; + protected $fillable = ['profile_id', 'visibility', 'in_reply_to_id', 'reblog_of_id', 'type']; const STATUS_TYPES = [ 'text', @@ -90,13 +90,13 @@ class Status extends Model public function url() { - if($this->url) { - return $this->url; + if($this->uri) { + return $this->uri; } $id = $this->id; $username = $this->profile->username; - $path = config('app.url')."/p/{$username}/{$id}"; - return url($path); + $path = url(config('app.url')."/p/{$username}/{$id}"); + return $path; } public function permalink($suffix = '/activity') From 1236f902cf2988fdb919517701e7efc3dd0b11e5 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 23 Dec 2018 19:08:53 -0700 Subject: [PATCH 2/3] Fix stories migration --- database/migrations/2018_09_19_060554_create_stories_table.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/migrations/2018_09_19_060554_create_stories_table.php b/database/migrations/2018_09_19_060554_create_stories_table.php index 5f204ea11..8701c964e 100644 --- a/database/migrations/2018_09_19_060554_create_stories_table.php +++ b/database/migrations/2018_09_19_060554_create_stories_table.php @@ -14,7 +14,7 @@ class CreateStoriesTable extends Migration public function up() { Schema::create('stories', function (Blueprint $table) { - $table->increments('bigIncrements'); + $table->bigIncrements('id'); $table->bigInteger('profile_id')->unsigned(); $table->timestamp('published_at')->nullable(); $table->timestamp('expires_at')->nullable(); From 9eb94bc9bb96e07b08c7804f7de0b4e88ea02e0d Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 23 Dec 2018 19:09:15 -0700 Subject: [PATCH 3/3] Add new migration --- ...0_add_account_status_to_profiles_table.php | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 database/migrations/2018_12_22_055940_add_account_status_to_profiles_table.php diff --git a/database/migrations/2018_12_22_055940_add_account_status_to_profiles_table.php b/database/migrations/2018_12_22_055940_add_account_status_to_profiles_table.php new file mode 100644 index 000000000..3d503c19d --- /dev/null +++ b/database/migrations/2018_12_22_055940_add_account_status_to_profiles_table.php @@ -0,0 +1,75 @@ +dropColumn('verify_token'); + $table->dropColumn('secret'); + $table->dropColumn('salmon_url'); + $table->dropColumn('hub_url'); + }); + } + + if(Schema::hasColumn('stories', 'bigIncrements')) { + Schema::table('stories', function (Blueprint $table) { + $table->dropColumn('bigIncrements'); + }); + Schema::table('stories', function (Blueprint $table) { + $table->bigIncrements('id')->first(); + }); + } + + // Add account status to profile and user tables + + Schema::table('profiles', function (Blueprint $table) { + $table->string('status')->nullable()->index()->after('username'); + }); + + Schema::table('users', function (Blueprint $table) { + $table->string('status')->nullable()->index()->after('email'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('profiles', function (Blueprint $table) { + $table->string('verify_token')->nullable(); + $table->string('secret')->nullable(); + $table->string('salmon_url')->nullable(); + $table->string('hub_url')->nullable(); + }); + + Schema::table('stories', function (Blueprint $table) { + $table->dropColumn('id'); + }); + Schema::table('stories', function (Blueprint $table) { + $table->bigIncrements('bigIncrements')->first(); + }); + + Schema::table('profiles', function (Blueprint $table) { + $table->dropColumn('status'); + }); + + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('status'); + }); + } +}