Pint database/

pull/6884/head
Daniel Supernault 4 weeks ago
parent 7fa0615448
commit db636ee08a
No known key found for this signature in database
GPG Key ID: 23740873EE6F76A1

@ -27,7 +27,7 @@ class AddFiltersToMediaTable extends Migration
public function down()
{
Schema::table('media', function (Blueprint $table) {
$table->dropColumn(['filter_name','filter_class']);
$table->dropColumn(['filter_name', 'filter_class']);
});
}
}

@ -29,7 +29,7 @@ class Add2faToUsersTable extends Migration
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(['2fa_enabled','2fa_secret','2fa_backup_codes','2fa_setup_at']);
$table->dropColumn(['2fa_enabled', '2fa_secret', '2fa_backup_codes', '2fa_setup_at']);
});
}
}

@ -29,7 +29,7 @@ class UpdateSettingsTable extends Migration
public function down()
{
Schema::table('user_settings', function (Blueprint $table) {
$table->dropColumn(['show_profile_followers','show_profile_follower_count','show_profile_following','show_profile_following_count']);
$table->dropColumn(['show_profile_followers', 'show_profile_follower_count', 'show_profile_following', 'show_profile_following_count']);
});
}
}

@ -32,7 +32,7 @@ class UpdateMediaTableAddAltText extends Migration
public function down()
{
Schema::table('media', function (Blueprint $table) {
$table->dropColumn(['original_sha256','optimized_sha256','caption','hls_path','hls_transcoded_at','key','metadata']);
$table->dropColumn(['original_sha256', 'optimized_sha256', 'caption', 'hls_path', 'hls_transcoded_at', 'key', 'metadata']);
});
}
}

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFollowRequestsTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateProfileTableAddApUrls extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateInstancesTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateImportDatasTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateActivitiesTable extends Migration
{

@ -1,8 +1,7 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;
class AddCwDescToStatus extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateStoriesTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateStoryReactionsTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCollectionsTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateDirectMessagesTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCollectionItemsTable extends Migration
{

@ -1,7 +1,5 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class UpdateStatusVisibilityDefaults extends Migration
@ -14,8 +12,7 @@ class UpdateStatusVisibilityDefaults extends Migration
public function up()
{
$type = config('database.default');
switch($type)
{
switch ($type) {
case 'mysql':
DB::statement("ALTER TABLE statuses CHANGE COLUMN visibility visibility ENUM('public','unlisted','private','direct', 'draft') NOT NULL DEFAULT 'public'");
break;

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateStatusAddScopeColumn extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateFollowerTableAddRemoteFlags extends Migration
{
@ -27,7 +27,7 @@ class UpdateFollowerTableAddRemoteFlags extends Migration
public function down()
{
Schema::table('followers', function (Blueprint $table) {
$table->dropColumn(['local_profile','local_following']);
$table->dropColumn(['local_profile', 'local_following']);
});
}
}

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateMediaAddAltText extends Migration
{
@ -30,7 +30,7 @@ class UpdateMediaAddAltText extends Migration
public function down()
{
Schema::table('media', function (Blueprint $table) {
$table->dropColumn(['license','is_nsfw','version','remote_media','remote_url']);
$table->dropColumn(['license', 'is_nsfw', 'version', 'remote_media', 'remote_url']);
});
}
}

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateProfileTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddTypeToStatusTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddAccountStatusToProfilesTable extends Migration
{
@ -14,13 +14,13 @@ class AddAccountStatusToProfilesTable extends Migration
public function up()
{
// Drop old columns, fix stories
if(Schema::hasColumn('profiles', 'hub_url')) {
if (Schema::hasColumn('profiles', 'hub_url')) {
Schema::table('profiles', function (Blueprint $table) {
$table->dropColumn(['verify_token','secret','salmon_url','hub_url']);
$table->dropColumn(['verify_token', 'secret', 'salmon_url', 'hub_url']);
});
}
if(Schema::hasColumn('stories', 'bigIncrements')) {
if (Schema::hasColumn('stories', 'bigIncrements')) {
Schema::table('stories', function (Blueprint $table) {
$table->dropColumn('bigIncrements');
});

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddDeleteAfterToUserTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateProfilesTableUseTextForBio extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateProfilesTable extends Migration
{
@ -28,7 +28,7 @@ class UpdateProfilesTable extends Migration
public function down()
{
Schema::table('profiles', function (Blueprint $table) {
$table->dropColumn(['unlisted','cw','no_autolink']);
$table->dropColumn(['unlisted', 'cw', 'no_autolink']);
});
}
}

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class Stories extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePagesTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddRemoteToAvatarsTable extends Migration
{
@ -27,7 +27,7 @@ class AddRemoteToAvatarsTable extends Migration
public function down()
{
Schema::table('avatars', function (Blueprint $table) {
$table->dropColumn(['remote_url','last_fetched_at']);
$table->dropColumn(['remote_url', 'last_fetched_at']);
});
}
}

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateDiscoverCategoriesTable extends Migration
{
@ -24,7 +24,7 @@ class CreateDiscoverCategoriesTable extends Migration
$table->boolean('local_only')->default(true);
$table->boolean('public_only')->default(true);
$table->boolean('photos_only')->default(true);
$table->timestamp('active_until')->nullable();
$table->timestamp('active_until')->nullable();
$table->timestamps();
});
}

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateDiscoverCategoryHashtagsTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateWebSocketsStatisticsEntriesTable extends Migration
{
@ -20,6 +20,7 @@ class CreateWebSocketsStatisticsEntriesTable extends Migration
$table->nullableTimestamps();
});
}
/**
* Reverse the migrations.
*/

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCirclesTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCircleProfilesTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddIndexes extends Migration
{
@ -14,7 +14,7 @@ class AddIndexes extends Migration
public function up()
{
Schema::table('statuses', function (Blueprint $table) {
$table->index('visibility','statuses_visibility_index');
$table->index('visibility', 'statuses_visibility_index');
$table->index(['in_reply_to_id', 'reblog_of_id'], 'statuses_in_reply_or_reblog_index');
$table->index('uri', 'statuses_uri_index');
$table->index('is_nsfw', 'statuses_is_nsfw_index');
@ -24,7 +24,7 @@ class AddIndexes extends Migration
});
Schema::table('notifications', function (Blueprint $table) {
$table->index('created_at','notifications_created_at_index');
$table->index('created_at', 'notifications_created_at_index');
$table->index('actor_id', 'notifications_actor_id_index');
});

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddSoftDeleteIndexes extends Migration
{
@ -14,35 +14,35 @@ class AddSoftDeleteIndexes extends Migration
public function up()
{
Schema::table('avatars', function (Blueprint $table) {
$table->index('deleted_at','avatars_deleted_at_index');
$table->index('deleted_at', 'avatars_deleted_at_index');
});
Schema::table('profiles', function (Blueprint $table) {
$table->index('deleted_at','profiles_deleted_at_index');
$table->index('deleted_at', 'profiles_deleted_at_index');
});
Schema::table('mentions', function (Blueprint $table) {
$table->index('deleted_at','mentions_deleted_at_index');
$table->index('deleted_at', 'mentions_deleted_at_index');
});
Schema::table('likes', function (Blueprint $table) {
$table->index('deleted_at','likes_deleted_at_index');
$table->index('deleted_at', 'likes_deleted_at_index');
});
Schema::table('statuses', function (Blueprint $table) {
$table->index('deleted_at','statuses_deleted_at_index');
$table->index('deleted_at', 'statuses_deleted_at_index');
});
Schema::table('media', function (Blueprint $table) {
$table->index('deleted_at','media_deleted_at_index');
$table->index('deleted_at', 'media_deleted_at_index');
});
Schema::table('notifications', function (Blueprint $table) {
$table->index('deleted_at','notifications_deleted_at_index');
$table->index('deleted_at', 'notifications_deleted_at_index');
});
Schema::table('users', function (Blueprint $table) {
$table->index('deleted_at','users_deleted_at_index');
$table->index('deleted_at', 'users_deleted_at_index');
});
}

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUserInvitesTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddProfileIdToStatusHashtagsTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUserDevicesTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddSnowflakeidsToUsersTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddRepliesCountToStatusesTable extends Migration
{
@ -27,7 +27,7 @@ class AddRepliesCountToStatusesTable extends Migration
public function down()
{
Schema::table('statuses', function (Blueprint $table) {
$table->dropColumn(['reply_count','comments_disabled']);
$table->dropColumn(['reply_count', 'comments_disabled']);
});
}
}

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddLayoutToProfilesTable extends Migration
{
@ -27,7 +27,7 @@ class AddLayoutToProfilesTable extends Migration
public function down()
{
Schema::table('profiles', function (Blueprint $table) {
$table->dropColumn(['profile_layout','post_layout']);
$table->dropColumn(['profile_layout', 'post_layout']);
});
}
}

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddSnowflakeIdsToCollectionsTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddSuggestionsToProfilesTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddHeaderToProfilesTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateContactsTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddProfileIdsToUsersTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateHashtagFollowsTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddStatusVisibilityToStatusHashtagsTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProfileSponsorsTable extends Migration
{

@ -1,8 +1,7 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;
class RemoveWebSubsTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePlacesTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddUniqueToStatusesTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddObjectIdToStatusesTable extends Migration
{

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddLanguageToUsersTable extends Migration
{

@ -6,34 +6,34 @@ use Illuminate\Support\Facades\Schema;
class AddFetchedAtToProfilesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('profiles', function (Blueprint $table) {
$table->timestamp('last_fetched_at')->nullable();
$table->unsignedInteger('status_count')->default(0)->nullable();
$table->unsignedInteger('followers_count')->default(0)->nullable();
$table->unsignedInteger('following_count')->default(0)->nullable();
$table->string('webfinger')->unique()->nullable()->index();
$table->string('avatar_url')->nullable();
$table->dropColumn('keybase_proof');
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('profiles', function (Blueprint $table) {
$table->timestamp('last_fetched_at')->nullable();
$table->unsignedInteger('status_count')->default(0)->nullable();
$table->unsignedInteger('followers_count')->default(0)->nullable();
$table->unsignedInteger('following_count')->default(0)->nullable();
$table->string('webfinger')->unique()->nullable()->index();
$table->string('avatar_url')->nullable();
$table->dropColumn('keybase_proof');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('profiles', function (Blueprint $table) {
$table->dropColumn(['last_fetched_at','status_count','followers_count','following_count','webfinger','avatar_url']);
$table->text('keybase_proof')->nullable()->after('post_layout');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('profiles', function (Blueprint $table) {
$table->dropColumn(['last_fetched_at', 'status_count', 'followers_count', 'following_count', 'webfinger', 'avatar_url']);
$table->text('keybase_proof')->nullable()->after('post_layout');
});
}
}

@ -36,10 +36,10 @@ class AddRemoteUrlToStoriesTable extends Migration
public function down()
{
Schema::table('stories', function (Blueprint $table) {
$table->dropColumn(['remote_url','media_url','is_archived','name']);
$table->dropColumn(['remote_url', 'media_url', 'is_archived', 'name']);
});
Schema::table('media', function (Blueprint $table) {
$table->dropColumn(['blurhash','srcset','width','height']);
$table->dropColumn(['blurhash', 'srcset', 'width', 'height']);
});
}
}

@ -6,29 +6,29 @@ use Illuminate\Support\Facades\Schema;
class AddTypeToDirectMessagesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('direct_messages', function (Blueprint $table) {
$table->string('type')->default('text')->nullable()->index()->after('from_id');
$table->boolean('is_hidden')->default(false)->index()->after('group_message');
$table->json('meta')->nullable()->after('is_hidden');
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('direct_messages', function (Blueprint $table) {
$table->string('type')->default('text')->nullable()->index()->after('from_id');
$table->boolean('is_hidden')->default(false)->index()->after('group_message');
$table->json('meta')->nullable()->after('is_hidden');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('direct_messages', function (Blueprint $table) {
$table->dropColumn(['type','is_hidden','meta']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('direct_messages', function (Blueprint $table) {
$table->dropColumn(['type', 'is_hidden', 'meta']);
});
}
}

@ -33,7 +33,7 @@ class CreateAccountInterstitialsTable extends Migration
$table->timestamps();
});
Schema::table('users', function(Blueprint $table) {
Schema::table('users', function (Blueprint $table) {
$table->boolean('has_interstitial')->default(false)->index();
});
}

@ -14,7 +14,7 @@ class AddProvidersColumnToOauthClientsTable extends Migration
public function up()
{
Schema::table('oauth_clients', function (Blueprint $table) {
if(Schema::hasTable('oauth_clients') && Schema::hasColumn('oauth_clients', 'provider') == false) {
if (Schema::hasTable('oauth_clients') && Schema::hasColumn('oauth_clients', 'provider') == false) {
$table->string('provider')->after('secret')->nullable();
}
});
@ -27,10 +27,10 @@ class AddProvidersColumnToOauthClientsTable extends Migration
*/
public function down()
{
if(Schema::hasTable('oauth_clients')) {
Schema::table('oauth_clients', function (Blueprint $table) {
$table->dropColumn('provider');
});
}
if (Schema::hasTable('oauth_clients')) {
Schema::table('oauth_clients', function (Blueprint $table) {
$table->dropColumn('provider');
});
}
}
}

@ -6,30 +6,30 @@ use Illuminate\Support\Facades\Schema;
class AddStatusProfileIdToLikesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('likes', function (Blueprint $table) {
$table->bigInteger('status_profile_id')->nullable()->unsigned()->index()->after('status_id');
$table->boolean('is_comment')->nullable()->index()->after('status_profile_id');
$table->dropColumn('flagged');
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('likes', function (Blueprint $table) {
$table->bigInteger('status_profile_id')->nullable()->unsigned()->index()->after('status_id');
$table->boolean('is_comment')->nullable()->index()->after('status_profile_id');
$table->dropColumn('flagged');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('likes', function (Blueprint $table) {
$table->dropColumn(['status_profile_id','is_comment']);
$table->boolean('flagged')->default(false);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('likes', function (Blueprint $table) {
$table->dropColumn(['status_profile_id', 'is_comment']);
$table->boolean('flagged')->default(false);
});
}
}

@ -6,28 +6,28 @@ use Illuminate\Support\Facades\Schema;
class AddSkipOptimizeToMediaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('media', function (Blueprint $table) {
$table->boolean('skip_optimize')->nullable()->index();
$table->timestamp('replicated_at')->nullable();
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('media', function (Blueprint $table) {
$table->boolean('skip_optimize')->nullable()->index();
$table->timestamp('replicated_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('media', function (Blueprint $table) {
$table->dropColumn(['skip_optimize','replicated_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('media', function (Blueprint $table) {
$table->dropColumn(['skip_optimize', 'replicated_at']);
});
}
}

@ -1,7 +1,6 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddCacheLocksTable extends Migration

@ -6,31 +6,31 @@ use Illuminate\Support\Facades\Schema;
class AddCdnUrlToAvatarsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('avatars', function (Blueprint $table) {
$table->string('cdn_url')->unique()->index()->nullable()->after('remote_url');
$table->unsignedInteger('size')->nullable()->after('cdn_url');
$table->boolean('is_remote')->nullable()->index()->after('cdn_url');
$table->dropColumn('thumb_path');
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('avatars', function (Blueprint $table) {
$table->string('cdn_url')->unique()->index()->nullable()->after('remote_url');
$table->unsignedInteger('size')->nullable()->after('cdn_url');
$table->boolean('is_remote')->nullable()->index()->after('cdn_url');
$table->dropColumn('thumb_path');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('avatars', function (Blueprint $table) {
$table->dropColumn(['cdn_url','size','is_remote']);
$table->string('thumb_path')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('avatars', function (Blueprint $table) {
$table->dropColumn(['cdn_url', 'size', 'is_remote']);
$table->string('thumb_path')->nullable();
});
}
}

@ -6,29 +6,29 @@ use Illuminate\Support\Facades\Schema;
class CreateConfigCachesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('config_cache', function (Blueprint $table) {
$table->id();
$table->string('k')->unique()->index();
$table->text('v')->nullable();
$table->json('metadata')->nullable();
$table->timestamps();
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('config_cache', function (Blueprint $table) {
$table->id();
$table->string('k')->unique()->index();
$table->text('v')->nullable();
$table->json('metadata')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('config_cache');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('config_cache');
}
}

@ -18,10 +18,10 @@ class AddComposeSettingsToUserSettingsTable extends Migration
});
Schema::table('media', function (Blueprint $table) {
$table->text('caption')->change();
$table->index('profile_id');
$table->index('mime');
$table->index('license');
$table->text('caption')->change();
$table->index('profile_id');
$table->index('mime');
$table->index('license');
});
}
@ -42,7 +42,9 @@ class AddComposeSettingsToUserSettingsTable extends Migration
$table->string('caption')->change();
$indexes = Schema::getIndexes('media');
$indexesFound = collect($indexes)->map(function($i) { return $i['name']; })->toArray();
$indexesFound = collect($indexes)->map(function ($i) {
return $i['name'];
})->toArray();
if (in_array('media_profile_id_index', $indexesFound)) {
$table->dropIndex('media_profile_id_index');
}

@ -6,37 +6,37 @@ use Illuminate\Support\Facades\Schema;
class CreatePollsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('polls', function (Blueprint $table) {
$table->bigInteger('id')->unsigned()->primary();
$table->bigInteger('story_id')->unsigned()->nullable()->index();
$table->bigInteger('status_id')->unsigned()->nullable()->index();
$table->bigInteger('group_id')->unsigned()->nullable()->index();
$table->bigInteger('profile_id')->unsigned()->index();
$table->json('poll_options')->nullable();
$table->json('cached_tallies')->nullable();
$table->boolean('multiple')->default(false);
$table->boolean('hide_totals')->default(false);
$table->unsignedInteger('votes_count')->default(0);
$table->timestamp('last_fetched_at')->nullable();
$table->timestamp('expires_at')->nullable();
$table->timestamps();
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('polls', function (Blueprint $table) {
$table->bigInteger('id')->unsigned()->primary();
$table->bigInteger('story_id')->unsigned()->nullable()->index();
$table->bigInteger('status_id')->unsigned()->nullable()->index();
$table->bigInteger('group_id')->unsigned()->nullable()->index();
$table->bigInteger('profile_id')->unsigned()->index();
$table->json('poll_options')->nullable();
$table->json('cached_tallies')->nullable();
$table->boolean('multiple')->default(false);
$table->boolean('hide_totals')->default(false);
$table->unsignedInteger('votes_count')->default(0);
$table->timestamp('last_fetched_at')->nullable();
$table->timestamp('expires_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('polls');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('polls');
}
}

@ -6,35 +6,35 @@ use Illuminate\Support\Facades\Schema;
class CreateGroupMembersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('group_members', function (Blueprint $table) {
$table->id();
$table->bigInteger('group_id')->unsigned()->index();
$table->bigInteger('profile_id')->unsigned()->index();
$table->string('role')->default('member')->index();
$table->boolean('local_group')->default(false)->index();
$table->boolean('local_profile')->default(false)->index();
$table->boolean('join_request')->default(false)->index();
$table->timestamp('approved_at')->nullable();
$table->timestamp('rejected_at')->nullable();
$table->unique(['group_id', 'profile_id']);
$table->timestamps();
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('group_members', function (Blueprint $table) {
$table->id();
$table->bigInteger('group_id')->unsigned()->index();
$table->bigInteger('profile_id')->unsigned()->index();
$table->string('role')->default('member')->index();
$table->boolean('local_group')->default(false)->index();
$table->boolean('local_profile')->default(false)->index();
$table->boolean('join_request')->default(false)->index();
$table->timestamp('approved_at')->nullable();
$table->timestamp('rejected_at')->nullable();
$table->unique(['group_id', 'profile_id']);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('group_members');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('group_members');
}
}

@ -6,37 +6,37 @@ use Illuminate\Support\Facades\Schema;
class CreateGroupPostsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('group_posts', function (Blueprint $table) {
$table->bigInteger('id')->unsigned()->primary();
$table->bigInteger('group_id')->unsigned()->index();
$table->bigInteger('profile_id')->unsigned()->nullable()->index();
$table->string('type')->nullable()->index();
$table->bigInteger('status_id')->unsigned()->unique();
$table->string('remote_url')->unique()->nullable()->index();
$table->bigInteger('reply_child_id')->unsigned()->nullable();
$table->bigInteger('in_reply_to_id')->unsigned()->nullable();
$table->bigInteger('reblog_of_id')->unsigned()->nullable();
$table->unsignedInteger('reply_count')->nullable();
$table->string('status')->nullable()->index();
$table->json('metadata')->nullable();
$table->timestamps();
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('group_posts', function (Blueprint $table) {
$table->bigInteger('id')->unsigned()->primary();
$table->bigInteger('group_id')->unsigned()->index();
$table->bigInteger('profile_id')->unsigned()->nullable()->index();
$table->string('type')->nullable()->index();
$table->bigInteger('status_id')->unsigned()->unique();
$table->string('remote_url')->unique()->nullable()->index();
$table->bigInteger('reply_child_id')->unsigned()->nullable();
$table->bigInteger('in_reply_to_id')->unsigned()->nullable();
$table->bigInteger('reblog_of_id')->unsigned()->nullable();
$table->unsignedInteger('reply_count')->nullable();
$table->string('status')->nullable()->index();
$table->json('metadata')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('group_posts');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('group_posts');
}
}

@ -6,31 +6,31 @@ use Illuminate\Support\Facades\Schema;
class CreateGroupRolesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('group_roles', function (Blueprint $table) {
$table->id();
$table->bigInteger('group_id')->unsigned()->index();
$table->string('name');
$table->string('slug')->nullable();
$table->text('abilities')->nullable();
$table->unique(['group_id', 'slug']);
$table->timestamps();
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('group_roles', function (Blueprint $table) {
$table->id();
$table->bigInteger('group_id')->unsigned()->index();
$table->string('name');
$table->string('slug')->nullable();
$table->text('abilities')->nullable();
$table->unique(['group_id', 'slug']);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('group_roles');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('group_roles');
}
}

@ -6,33 +6,33 @@ use Illuminate\Support\Facades\Schema;
class CreateGroupInvitationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('group_invitations', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('group_id')->unsigned()->index();
$table->bigInteger('from_profile_id')->unsigned()->index();
$table->bigInteger('to_profile_id')->unsigned()->index();
$table->string('role')->nullable();
$table->boolean('to_local')->default(true)->index();
$table->boolean('from_local')->default(true)->index();
$table->unique(['group_id', 'to_profile_id']);
$table->timestamps();
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('group_invitations', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('group_id')->unsigned()->index();
$table->bigInteger('from_profile_id')->unsigned()->index();
$table->bigInteger('to_profile_id')->unsigned()->index();
$table->string('role')->nullable();
$table->boolean('to_local')->default(true)->index();
$table->boolean('from_local')->default(true)->index();
$table->unique(['group_id', 'to_profile_id']);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('group_invitations');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('group_invitations');
}
}

@ -6,32 +6,32 @@ use Illuminate\Support\Facades\Schema;
class CreateGroupInteractionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('group_interactions', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('group_id')->unsigned()->index();
$table->bigInteger('profile_id')->unsigned()->index();
$table->string('type')->nullable()->index();
$table->string('item_type')->nullable()->index();
$table->string('item_id')->nullable()->index();
$table->json('metadata')->nullable();
$table->timestamps();
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('group_interactions', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('group_id')->unsigned()->index();
$table->bigInteger('profile_id')->unsigned()->index();
$table->string('type')->nullable()->index();
$table->string('item_type')->nullable()->index();
$table->string('item_id')->nullable()->index();
$table->json('metadata')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('group_interactions');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('group_interactions');
}
}

@ -16,13 +16,13 @@ class CreateGroupReportsTable extends Migration
Schema::create('group_reports', function (Blueprint $table) {
$table->id();
$table->bigInteger('group_id')->unsigned()->index();
$table->bigInteger('profile_id')->unsigned()->index();
$table->string('type')->nullable()->index();
$table->string('item_type')->nullable()->index();
$table->string('item_id')->nullable()->index();
$table->json('metadata')->nullable();
$table->boolean('open')->default(true)->index();
$table->unique(['group_id', 'profile_id', 'item_type', 'item_id']);
$table->bigInteger('profile_id')->unsigned()->index();
$table->string('type')->nullable()->index();
$table->string('item_type')->nullable()->index();
$table->string('item_id')->nullable()->index();
$table->json('metadata')->nullable();
$table->boolean('open')->default(true)->index();
$table->unique(['group_id', 'profile_id', 'item_type', 'item_id']);
$table->timestamps();
});
}

@ -6,47 +6,51 @@ use Illuminate\Support\Facades\Schema;
class UpdateStoriesTableFixExpiresAtColumn extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('stories', function (Blueprint $table) {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('stories', function (Blueprint $table) {
$indexes = Schema::getIndexes('stories');
$indexesFound = collect($indexes)->map(function($i) { return $i['name']; })->toArray();
$indexesFound = collect($indexes)->map(function ($i) {
return $i['name'];
})->toArray();
if (in_array('stories_expires_at_index', $indexesFound)) {
$table->dropIndex('stories_expires_at_index');
}
$table->timestamp('expires_at')->default(null)->index()->nullable()->change();
$table->boolean('can_reply')->default(true);
$table->boolean('can_react')->default(true);
$table->string('object_id')->nullable()->unique();
$table->string('object_uri')->nullable()->unique();
$table->string('bearcap_token')->nullable();
});
}
$table->timestamp('expires_at')->default(null)->index()->nullable()->change();
$table->boolean('can_reply')->default(true);
$table->boolean('can_react')->default(true);
$table->string('object_id')->nullable()->unique();
$table->string('object_uri')->nullable()->unique();
$table->string('bearcap_token')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('stories', function (Blueprint $table) {
$indexes = Schema::getIndexes('stories');
$indexesFound = collect($indexes)->map(function($i) { return $i['name']; })->toArray();
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('stories', function (Blueprint $table) {
$indexes = Schema::getIndexes('stories');
$indexesFound = collect($indexes)->map(function ($i) {
return $i['name'];
})->toArray();
if (in_array('stories_expires_at_index', $indexesFound)) {
$table->dropIndex('stories_expires_at_index');
}
$table->timestamp('expires_at')->default(null)->index()->nullable()->change();
$table->dropColumn('can_reply');
$table->dropColumn('can_react');
$table->dropColumn('object_id');
$table->dropColumn('object_uri');
$table->dropColumn('bearcap_token');
});
}
$table->timestamp('expires_at')->default(null)->index()->nullable()->change();
$table->dropColumn('can_reply');
$table->dropColumn('can_react');
$table->dropColumn('object_id');
$table->dropColumn('object_uri');
$table->dropColumn('bearcap_token');
});
}
}

@ -1,46 +1,46 @@
<?php
use App\Jobs\InstancePipeline\InstanceCrawlPipeline;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use App\Jobs\InstancePipeline\InstanceCrawlPipeline;
class AddSoftwareColumnToInstancesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('instances', function (Blueprint $table) {
$table->string('software')->nullable()->index();
$table->unsignedInteger('user_count')->nullable();
$table->unsignedInteger('status_count')->nullable();
$table->timestamp('last_crawled_at')->nullable();
});
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('instances', function (Blueprint $table) {
$table->string('software')->nullable()->index();
$table->unsignedInteger('user_count')->nullable();
$table->unsignedInteger('status_count')->nullable();
$table->timestamp('last_crawled_at')->nullable();
});
$this->runPostMigration();
}
$this->runPostMigration();
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('instances', function (Blueprint $table) {
$table->dropColumn('software');
$table->dropColumn('user_count');
$table->dropColumn('status_count');
$table->dropColumn('last_crawled_at');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('instances', function (Blueprint $table) {
$table->dropColumn('software');
$table->dropColumn('user_count');
$table->dropColumn('status_count');
$table->dropColumn('last_crawled_at');
});
}
protected function runPostMigration()
{
InstanceCrawlPipeline::dispatch();
}
protected function runPostMigration()
{
InstanceCrawlPipeline::dispatch();
}
}

@ -16,14 +16,14 @@ class CreateGroupBlocksTable extends Migration
Schema::create('group_blocks', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('group_id')->unsigned()->index();
$table->bigInteger('admin_id')->unsigned()->nullable();
$table->bigInteger('profile_id')->nullable()->unsigned()->index();
$table->bigInteger('instance_id')->nullable()->unsigned()->index();
$table->string('name')->nullable()->index();
$table->string('reason')->nullable();
$table->boolean('is_user')->index();
$table->boolean('moderated')->default(false)->index();
$table->unique(['group_id', 'profile_id', 'instance_id']);
$table->bigInteger('admin_id')->unsigned()->nullable();
$table->bigInteger('profile_id')->nullable()->unsigned()->index();
$table->bigInteger('instance_id')->nullable()->unsigned()->index();
$table->string('name')->nullable()->index();
$table->string('reason')->nullable();
$table->boolean('is_user')->index();
$table->boolean('moderated')->default(false)->index();
$table->unique(['group_id', 'profile_id', 'instance_id']);
$table->timestamps();
});
}

@ -16,10 +16,10 @@ class CreateGroupLimitsTable extends Migration
Schema::create('group_limits', function (Blueprint $table) {
$table->id();
$table->bigInteger('group_id')->unsigned()->index();
$table->bigInteger('profile_id')->unsigned()->index();
$table->json('limits')->nullable();
$table->json('metadata')->nullable();
$table->unique(['group_id', 'profile_id']);
$table->bigInteger('profile_id')->unsigned()->index();
$table->json('limits')->nullable();
$table->json('metadata')->nullable();
$table->unique(['group_id', 'profile_id']);
$table->timestamps();
});
}

@ -6,39 +6,39 @@ use Illuminate\Support\Facades\Schema;
class CreateGroupEventsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('group_events', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('group_id')->unsigned()->nullable()->index();
$table->bigInteger('profile_id')->unsigned()->nullable()->index();
$table->string('name')->nullable();
$table->string('type')->index();
$table->json('tags')->nullable();
$table->json('location')->nullable();
$table->text('description')->nullable();
$table->json('metadata')->nullable();
$table->boolean('open')->default(false)->index();
$table->boolean('comments_open')->default(false);
$table->boolean('show_guest_list')->default(false);
$table->timestamp('start_at')->nullable();
$table->timestamp('end_at')->nullable();
$table->timestamps();
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('group_events', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('group_id')->unsigned()->nullable()->index();
$table->bigInteger('profile_id')->unsigned()->nullable()->index();
$table->string('name')->nullable();
$table->string('type')->index();
$table->json('tags')->nullable();
$table->json('location')->nullable();
$table->text('description')->nullable();
$table->json('metadata')->nullable();
$table->boolean('open')->default(false)->index();
$table->boolean('comments_open')->default(false);
$table->boolean('show_guest_list')->default(false);
$table->timestamp('start_at')->nullable();
$table->timestamp('end_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('group_events');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('group_events');
}
}

@ -6,27 +6,27 @@ use Illuminate\Support\Facades\Schema;
class AddMoreSettingsToUserSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('user_settings', function (Blueprint $table) {
$table->json('other')->nullable();
});
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('user_settings', function (Blueprint $table) {
$table->json('other')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('user_settings', function (Blueprint $table) {
$table->dropColumn('other');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('user_settings', function (Blueprint $table) {
$table->dropColumn('other');
});
}
}

@ -14,7 +14,7 @@ class AddActionToAccountInterstitialsTable extends Migration
public function up()
{
Schema::table('account_interstitials', function (Blueprint $table) {
$table->tinyInteger('severity_index')->unsigned()->nullable()->index();
$table->tinyInteger('severity_index')->unsigned()->nullable()->index();
$table->boolean('is_spam')->nullable()->index()->after('item_type');
$table->boolean('in_violation')->nullable()->index()->after('is_spam');
$table->unsignedInteger('violation_id')->nullable()->index()->after('in_violation');

@ -6,42 +6,42 @@ use Illuminate\Support\Facades\Schema;
class CreateCustomEmojiTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('custom_emoji', function (Blueprint $table) {
$table->id();
$table->string('shortcode')->index();
$table->string('media_path')->nullable();
$table->string('domain')->nullable()->index();
$table->boolean('disabled')->default(false)->index();
$table->string('uri')->nullable();
$table->string('image_remote_url')->nullable();
$table->unsignedInteger('category_id')->nullable();
$table->unique(['shortcode', 'domain']);
$table->timestamps();
});
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('custom_emoji', function (Blueprint $table) {
$table->id();
$table->string('shortcode')->index();
$table->string('media_path')->nullable();
$table->string('domain')->nullable()->index();
$table->boolean('disabled')->default(false)->index();
$table->string('uri')->nullable();
$table->string('image_remote_url')->nullable();
$table->unsignedInteger('category_id')->nullable();
$table->unique(['shortcode', 'domain']);
$table->timestamps();
});
Schema::create('custom_emoji_categories', function (Blueprint $table) {
$table->id();
$table->string('name')->unique()->index();
$table->boolean('disabled')->default(false)->index();
$table->timestamps();
});
}
Schema::create('custom_emoji_categories', function (Blueprint $table) {
$table->id();
$table->string('name')->unique()->index();
$table->boolean('disabled')->default(false)->index();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('custom_emoji');
Schema::dropIfExists('custom_emoji_categories');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('custom_emoji');
Schema::dropIfExists('custom_emoji_categories');
}
}

@ -1,9 +1,7 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use App\Status;
use Illuminate\Database\Migrations\Migration;
class AddMissingReblogOfIdTypesToStatusesTable extends Migration
{
@ -15,10 +13,10 @@ class AddMissingReblogOfIdTypesToStatusesTable extends Migration
public function up()
{
Status::whereNotNull('reblog_of_id')
->whereNull('type')
->update([
'type' => 'share'
]);
->whereNull('type')
->update([
'type' => 'share',
]);
}
/**
@ -26,7 +24,5 @@ class AddMissingReblogOfIdTypesToStatusesTable extends Migration
*
* @return void
*/
public function down()
{
}
public function down() {}
}

@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddLdapColumnsToUsersTable extends Migration
{

@ -1,11 +1,10 @@
<?php
use App\DirectMessage;
use App\Models\Conversation;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use App\DirectMessage;
use App\Models\Conversation;
use Illuminate\Support\Facades\DB;
class CreateConversationsTable extends Migration
{
@ -16,7 +15,7 @@ class CreateConversationsTable extends Migration
*/
public function up()
{
Schema::dropIfExists('conversations');
Schema::dropIfExists('conversations');
Schema::create('conversations', function (Blueprint $table) {
$table->bigIncrements('id');
@ -34,21 +33,21 @@ class CreateConversationsTable extends Migration
sleep(10);
if(DirectMessage::count()) {
if (DirectMessage::count()) {
foreach(DirectMessage::lazy() as $msg) {
Conversation::updateOrInsert([
'to_id' => $msg->to_id,
'from_id' => $msg->from_id,
],
[
'dm_id' => $msg->id,
'status_id' => $msg->status_id,
'type' => $msg->type,
'created_at' => $msg->created_at,
'updated_at' => $msg->updated_at
]);
}
foreach (DirectMessage::lazy() as $msg) {
Conversation::updateOrInsert([
'to_id' => $msg->to_id,
'from_id' => $msg->from_id,
],
[
'dm_id' => $msg->id,
'status_id' => $msg->status_id,
'type' => $msg->type,
'created_at' => $msg->created_at,
'updated_at' => $msg->updated_at,
]);
}
}
}

@ -1,10 +1,8 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use App\Profile;
use App\Jobs\DeletePipeline\DeleteRemoteProfilePipeline;
use App\Profile;
use Illuminate\Database\Migrations\Migration;
class FixWebfingerProfileDuplicateAccounts extends Migration
{
@ -15,16 +13,16 @@ class FixWebfingerProfileDuplicateAccounts extends Migration
*/
public function up()
{
if(Profile::count() === 0) {
if (Profile::count() === 0) {
return;
}
Profile::whereNotNull('domain')
->where('username', 'not like', '@%')
->chunk(200, function($profiles) {
foreach($profiles as $profile) {
->chunk(200, function ($profiles) {
foreach ($profiles as $profile) {
$exists = Profile::whereUsername("@{$profile->username}@{$profile->domain}")->first();
if($exists) {
if ($exists) {
$exists->username = null;
$exists->domain = null;
$exists->webfinger = null;
@ -32,13 +30,13 @@ class FixWebfingerProfileDuplicateAccounts extends Migration
DeleteRemoteProfilePipeline::dispatch($exists);
$profile->username = "@{$profile->username}@{$profile->domain}";
if(!$profile->webfinger) {
if (! $profile->webfinger) {
$profile->webfinger = "@{$profile->username}@{$profile->domain}";
}
$profile->save();
} else {
$profile->username = "@{$profile->username}@{$profile->domain}";
if(!$profile->webfinger) {
if (! $profile->webfinger) {
$profile->webfinger = "@{$profile->username}@{$profile->domain}";
}
$profile->save();

@ -1,9 +1,7 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use App\Profile;
use Illuminate\Database\Migrations\Migration;
class GenerateMissingProfileWebfinger extends Migration
{
@ -16,9 +14,9 @@ class GenerateMissingProfileWebfinger extends Migration
{
Profile::whereNotNull('domain')
->whereNull('webfinger')
->chunk(200, function($profiles) {
foreach($profiles as $profile) {
if(substr($profile->username, 0, 1) === "@") {
->chunk(200, function ($profiles) {
foreach ($profiles as $profile) {
if (substr($profile->username, 0, 1) === '@') {
$profile->webfinger = $profile->username;
$profile->save();
}

@ -1,9 +1,7 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use App\UserSetting;
use Illuminate\Database\Migrations\Migration;
class FixDoubleJsonEncodedSettingsInUsersettingsTable extends Migration
{
@ -15,15 +13,15 @@ class FixDoubleJsonEncodedSettingsInUsersettingsTable extends Migration
public function up()
{
UserSetting::whereNotNull('compose_settings')
->chunk(50, function($settings) {
foreach($settings as $userSetting) {
if(is_array($userSetting->compose_settings)) {
continue;
->chunk(50, function ($settings) {
foreach ($settings as $userSetting) {
if (is_array($userSetting->compose_settings)) {
continue;
}
$userSetting->compose_settings = json_decode($userSetting->compose_settings);
$userSetting->save();
}
$userSetting->compose_settings = json_decode($userSetting->compose_settings);
$userSetting->save();
}
});
});
}
/**
@ -31,8 +29,5 @@ class FixDoubleJsonEncodedSettingsInUsersettingsTable extends Migration
*
* @return void
*/
public function down()
{
}
public function down() {}
}

@ -15,7 +15,9 @@ class RemoveOldCompoundIndexFromStatusesTable extends Migration
{
Schema::table('statuses', function (Blueprint $table) {
$indexes = Schema::getIndexes('statuses');
$indexesFound = collect($indexes)->map(function($i) { return $i['name']; })->toArray();
$indexesFound = collect($indexes)->map(function ($i) {
return $i['name'];
})->toArray();
if (in_array('statuses_in_reply_to_id_reblog_of_id_index', $indexesFound)) {
$table->dropIndex('statuses_in_reply_to_id_reblog_of_id_index');
}

@ -1,11 +1,9 @@
<?php
use App\Avatar;
use App\Services\AccountService;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Cache;
use App\Services\AccountService;
use App\Avatar;
class FixCdnUrlInAvatarsTable extends Migration
{
@ -16,18 +14,18 @@ class FixCdnUrlInAvatarsTable extends Migration
*/
public function up()
{
$baseUrl = 'https://' . config('pixelfed.domain.app');
$baseUrl = 'https://'.config('pixelfed.domain.app');
Avatar::whereNotNull('cdn_url')
->chunk(50, function($avatars) use($baseUrl) {
foreach($avatars as $avatar) {
if(substr($avatar->cdn_url, 0, 23) === '/storage/cache/avatars/') {
$avatar->cdn_url = $baseUrl . $avatar->cdn_url;
$avatar->save();
->chunk(50, function ($avatars) use ($baseUrl) {
foreach ($avatars as $avatar) {
if (substr($avatar->cdn_url, 0, 23) === '/storage/cache/avatars/') {
$avatar->cdn_url = $baseUrl.$avatar->cdn_url;
$avatar->save();
}
Cache::forget('avatar:'.$avatar->profile_id);
AccountService::del($avatar->profile_id);
}
Cache::forget('avatar:' . $avatar->profile_id);
AccountService::del($avatar->profile_id);
}
});
});
}
/**
@ -35,7 +33,5 @@ class FixCdnUrlInAvatarsTable extends Migration
*
* @return void
*/
public function down()
{
}
public function down() {}
}

@ -15,7 +15,9 @@ return new class extends Migration
{
Schema::table('avatars', function (Blueprint $table) {
$indexes = Schema::getIndexes('avatars');
$indexesFound = collect($indexes)->map(function($i) { return $i['name']; })->toArray();
$indexesFound = collect($indexes)->map(function ($i) {
return $i['name'];
})->toArray();
if (in_array('avatars_cdn_url_unique', $indexesFound)) {
$table->dropUnique('avatars_cdn_url_unique');
}

@ -25,7 +25,6 @@ return new class extends Migration
*/
public function down()
{
Schema::table('admin_invites', function (Blueprint $table) {
});
Schema::table('admin_invites', function (Blueprint $table) {});
}
};

@ -1,10 +1,8 @@
<?php
use App\Hashtag;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
use App\Hashtag;
return new class extends Migration
{
@ -15,9 +13,9 @@ return new class extends Migration
*/
public function up()
{
Hashtag::withoutEvents(function() {
Hashtag::whereNotNull('cached_count')->chunkById(50, function($hashtags) {
foreach($hashtags as $hashtag) {
Hashtag::withoutEvents(function () {
Hashtag::whereNotNull('cached_count')->chunkById(50, function ($hashtags) {
foreach ($hashtags as $hashtag) {
$count = DB::table('status_hashtags')->whereHashtagId($hashtag->id)->count();
$hashtag->cached_count = $count;
$hashtag->can_trend = true;

@ -1,10 +1,8 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use App\Status;
use App\Jobs\StatusPipeline\StatusDelete;
use App\Status;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
{
@ -15,7 +13,9 @@ return new class extends Migration
*/
public function up()
{
Status::doesntHave('profile')->get()->each(function($status) { StatusDelete::dispatch($status); });
Status::doesntHave('profile')->get()->each(function ($status) {
StatusDelete::dispatch($status);
});
}
/**

@ -1,10 +1,8 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use App\Profile;
use App\User;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
{
@ -16,15 +14,15 @@ return new class extends Migration
public function up()
{
User::whereNull('profile_id')
->chunk(20, function($users) {
foreach($users as $user) {
$profile = Profile::whereUsername($user->username)->first();
if($profile) {
$user->profile_id = $profile->id;
$user->save();
->chunk(20, function ($users) {
foreach ($users as $user) {
$profile = Profile::whereUsername($user->username)->first();
if ($profile) {
$user->profile_id = $profile->id;
$user->save();
}
}
}
});
});
}
/**
@ -32,8 +30,5 @@ return new class extends Migration
*
* @return void
*/
public function down()
{
}
public function down() {}
};

@ -1,11 +1,9 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use App\Bookmark;
use App\Status;
use App\Services\FollowerService;
use App\Status;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
{
@ -16,24 +14,26 @@ return new class extends Migration
*/
public function up()
{
Bookmark::chunk(200, function($bookmarks) {
foreach($bookmarks as $bookmark) {
Bookmark::chunk(200, function ($bookmarks) {
foreach ($bookmarks as $bookmark) {
$status = Status::find($bookmark->status_id);
if(!$status) {
if (! $status) {
$bookmark->delete();
continue;
}
if(!in_array($status->visibility, ['public', 'unlisted', 'private'])) {
if (! in_array($status->visibility, ['public', 'unlisted', 'private'])) {
$bookmark->delete();
continue;
}
if(!in_array($status->visibility, ['public', 'unlisted'])) {
if($bookmark->profile_id == $status->profile_id) {
if (! in_array($status->visibility, ['public', 'unlisted'])) {
if ($bookmark->profile_id == $status->profile_id) {
continue;
} else {
if(!FollowerService::follows($bookmark->profile_id, $status->profile_id)) {
if (! FollowerService::follows($bookmark->profile_id, $status->profile_id)) {
$bookmark->delete();
}
}

@ -1,8 +1,6 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Artisan;
return new class extends Migration

@ -1,13 +1,10 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\DB;
use App\Media;
use App\Services\MediaService;
use App\Services\StatusService;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Storage;
return new class extends Migration
{
@ -19,40 +16,39 @@ return new class extends Migration
public function up()
{
ini_set('memory_limit', '-1');
if((bool) config_cache('pixelfed.cloud_storage') == false) {
if ((bool) config_cache('pixelfed.cloud_storage') == false) {
return;
}
$disk = Storage::disk(config('filesystems.cloud'));
$startUrl = $disk->url('test');
if(!$startUrl) {
if (! $startUrl) {
return;
}
$baseUrl = substr($startUrl, 0, -4);
$baseUrlLen = strlen($baseUrl);
foreach(Media::whereNotNull('cdn_url')->lazyById(200, 'id') as $media) {
if($media->cdn_url == null) {
foreach (Media::whereNotNull('cdn_url')->lazyById(200, 'id') as $media) {
if ($media->cdn_url == null) {
continue;
}
$cdnPath = substr($media->cdn_url, $baseUrlLen);
if(str_starts_with($cdnPath, '/')) {
if (str_starts_with($cdnPath, '/')) {
continue;
}
if(!str_starts_with($cdnPath, 'public/')) {
if (! str_starts_with($cdnPath, 'public/')) {
continue;
}
if($cdnPath != $media->media_path) {
if ($cdnPath != $media->media_path) {
$media->media_path = $cdnPath;
$media->saveQuietly();
if($media->status_id) {
if ($media->status_id) {
MediaService::del($media->status_id);
StatusService::del($media->status_id);
}
}
}
return;
}
/**

@ -1,17 +1,15 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use App\Follower;
use App\Notification;
use App\Profile;
use App\UserFilter;
use App\Services\AccountService;
use App\Services\FollowerService;
use App\Services\NotificationService;
use App\Services\RelationshipService;
use App\Services\UserFilterService;
use App\UserFilter;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
{
@ -21,54 +19,54 @@ return new class extends Migration
public function up(): void
{
UserFilter::whereFilterType('block')
->whereFilterableType(\App\Profile::class)
->chunk(10, function($filters) {
foreach($filters as $filter) {
$actor = Profile::whereNull('status')->find($filter->user_id);
if(!$actor) {
continue;
}
$target = Profile::whereNull('status')->find($filter->filterable_id);
if(!$target) {
continue;
}
->whereFilterableType(Profile::class)
->chunk(10, function ($filters) {
foreach ($filters as $filter) {
$actor = Profile::whereNull('status')->find($filter->user_id);
if (! $actor) {
continue;
}
$target = Profile::whereNull('status')->find($filter->filterable_id);
if (! $target) {
continue;
}
$followed = Follower::whereProfileId($target->id)->whereFollowingId($actor->id)->first();
if($followed) {
$followed->delete();
$target->following_count = Follower::whereProfileId($target->id)->count();
$target->save();
$actor->followers_count = Follower::whereFollowingId($actor->id)->count();
$actor->save();
FollowerService::remove($target->id, $actor->id);
AccountService::del($actor->id);
AccountService::del($target->id);
}
$followed = Follower::whereProfileId($target->id)->whereFollowingId($actor->id)->first();
if ($followed) {
$followed->delete();
$target->following_count = Follower::whereProfileId($target->id)->count();
$target->save();
$actor->followers_count = Follower::whereFollowingId($actor->id)->count();
$actor->save();
FollowerService::remove($target->id, $actor->id);
AccountService::del($actor->id);
AccountService::del($target->id);
}
$following = Follower::whereProfileId($actor->id)->whereFollowingId($target->id)->first();
if($following) {
$following->delete();
$actor->followers_count = Follower::whereFollowingId($target->id)->count();
$actor->save();
$target->following_count = Follower::whereProfileId($actor->id)->count();
$target->save();
FollowerService::remove($actor->id, $target->id);
AccountService::del($actor->id);
AccountService::del($target->id);
}
$following = Follower::whereProfileId($actor->id)->whereFollowingId($target->id)->first();
if ($following) {
$following->delete();
$actor->followers_count = Follower::whereFollowingId($target->id)->count();
$actor->save();
$target->following_count = Follower::whereProfileId($actor->id)->count();
$target->save();
FollowerService::remove($actor->id, $target->id);
AccountService::del($actor->id);
AccountService::del($target->id);
}
Notification::whereProfileId($actor->id)
->whereActorId($target->id)
->get()
->map(function($n) use($actor) {
NotificationService::del($actor->id, $n['id']);
$n->forceDelete();
});
Notification::whereProfileId($actor->id)
->whereActorId($target->id)
->get()
->map(function ($n) use ($actor) {
NotificationService::del($actor->id, $n['id']);
$n->forceDelete();
});
UserFilterService::block($actor->id, $target->id);
RelationshipService::refresh($actor->id, $target->id);
}
});
UserFilterService::block($actor->id, $target->id);
RelationshipService::refresh($actor->id, $target->id);
}
});
}
/**

@ -1,8 +1,6 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
return new class extends Migration
@ -14,15 +12,15 @@ return new class extends Migration
{
$type = config('database.default');
if($type === 'pgsql') {
DB::statement("ALTER TABLE statuses DROP CONSTRAINT IF EXISTS statuses_visibility_check");
if ($type === 'pgsql') {
DB::statement('ALTER TABLE statuses DROP CONSTRAINT IF EXISTS statuses_visibility_check');
$types = ['public', 'unlisted', 'private', 'direct', 'draft'];
$result = join( ', ', array_map(function ($value){
return sprintf("'%s'::character varying", $value);
}, $types));
$types = ['public', 'unlisted', 'private', 'direct', 'draft'];
$result = implode(', ', array_map(function ($value) {
return sprintf("'%s'::character varying", $value);
}, $types));
DB::statement("ALTER TABLE statuses ADD CONSTRAINT statuses_visibility_check CHECK (visibility::text = ANY (ARRAY[$result]::text[]))");
DB::statement("ALTER TABLE statuses ADD CONSTRAINT statuses_visibility_check CHECK (visibility::text = ANY (ARRAY[$result]::text[]))");
}
}

@ -1,10 +1,8 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use App\Hashtag;
use App\StatusHashtag;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Cache;
return new class extends Migration
@ -16,21 +14,21 @@ return new class extends Migration
{
$type = config('database.default');
if($type !== 'pgsql') {
return;
if ($type !== 'pgsql') {
return;
}
foreach(Hashtag::lazyById(50, 'id') as $tag) {
$dups = Hashtag::where('name', 'ilike', $tag->name)->orderBy('id')->get();
if($dups->count() === 1) {
continue;
}
foreach (Hashtag::lazyById(50, 'id') as $tag) {
$dups = Hashtag::where('name', 'ilike', $tag->name)->orderBy('id')->get();
if ($dups->count() === 1) {
continue;
}
$first = $dups->shift();
$dups->each(function($dup) use($first) {
StatusHashtag::whereHashtagId($dup->id)->update(['hashtag_id' => $first->id]);
$dup->delete();
});
$first = $dups->shift();
$dups->each(function ($dup) use ($first) {
StatusHashtag::whereHashtagId($dup->id)->update(['hashtag_id' => $first->id]);
$dup->delete();
});
}
Cache::clear();

@ -12,20 +12,18 @@ return new class extends Migration
public function up(): void
{
Schema::table('notifications', function (Blueprint $table) {
if(Schema::hasColumn('notifications', 'message')) {
$table->dropColumn('message');
}
if (Schema::hasColumn('notifications', 'message')) {
$table->dropColumn('message');
}
if(Schema::hasColumn('notifications', 'rendered')) {
$table->dropColumn('rendered');
}
if (Schema::hasColumn('notifications', 'rendered')) {
$table->dropColumn('rendered');
}
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
}
public function down(): void {}
};

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save