From e3899d3684da370b40fa638242a8567d16a4b63d Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 31 May 2021 23:26:40 -0600 Subject: [PATCH] Fix migration sqlite support --- ...6_11_030049_add_filters_to_media_table.php | 3 +- ...18_07_15_011916_add_2fa_to_users_table.php | 5 +- ...018_08_22_022306_update_settings_table.php | 5 +- ...004653_update_media_table_add_alt_text.php | 8 +-- ...update_follower_table_add_remote_flags.php | 3 +- ...10_18_035552_update_media_add_alt_text.php | 6 +- ...0_add_account_status_to_profiles_table.php | 5 +- ...019_01_11_005556_update_profiles_table.php | 4 +- .../migrations/2019_01_12_054413_stories.php | 7 +-- ..._01_023357_add_remote_to_avatars_table.php | 3 +- ...16_add_replies_count_to_statuses_table.php | 3 +- ...16_184644_add_layout_to_profiles_table.php | 3 +- ...45459_add_fetched_at_to_profiles_table.php | 63 +++++++++---------- ...022520_add_remote_url_to_stories_table.php | 10 +-- ...1947_add_type_to_direct_messages_table.php | 50 +++++++-------- ...5_add_status_profile_id_to_likes_table.php | 51 ++++++++------- ...40951_add_skip_optimize_to_media_table.php | 47 +++++++------- ...25_011355_add_cdn_url_to_avatars_table.php | 54 ++++++++-------- 18 files changed, 141 insertions(+), 189 deletions(-) diff --git a/database/migrations/2018_06_11_030049_add_filters_to_media_table.php b/database/migrations/2018_06_11_030049_add_filters_to_media_table.php index 2d2f9cc9b..dac0a0828 100644 --- a/database/migrations/2018_06_11_030049_add_filters_to_media_table.php +++ b/database/migrations/2018_06_11_030049_add_filters_to_media_table.php @@ -27,8 +27,7 @@ class AddFiltersToMediaTable extends Migration public function down() { Schema::table('media', function (Blueprint $table) { - $table->dropColumn('filter_name'); - $table->dropColumn('filter_class'); + $table->dropColumn(['filter_name','filter_class']); }); } } diff --git a/database/migrations/2018_07_15_011916_add_2fa_to_users_table.php b/database/migrations/2018_07_15_011916_add_2fa_to_users_table.php index 206101037..8cdcc8983 100644 --- a/database/migrations/2018_07_15_011916_add_2fa_to_users_table.php +++ b/database/migrations/2018_07_15_011916_add_2fa_to_users_table.php @@ -29,10 +29,7 @@ class Add2faToUsersTable extends Migration public function down() { Schema::table('users', function (Blueprint $table) { - $table->dropColumn('2fa_enabled'); - $table->dropColumn('2fa_secret'); - $table->dropColumn('2fa_backup_codes'); - $table->dropColumn('2fa_setup_at'); + $table->dropColumn(['2fa_enabled','2fa_secret','2fa_backup_codes','2fa_setup_at']); }); } } diff --git a/database/migrations/2018_08_22_022306_update_settings_table.php b/database/migrations/2018_08_22_022306_update_settings_table.php index f4a9db325..e42345ec6 100644 --- a/database/migrations/2018_08_22_022306_update_settings_table.php +++ b/database/migrations/2018_08_22_022306_update_settings_table.php @@ -29,10 +29,7 @@ class UpdateSettingsTable extends Migration public function down() { Schema::table('user_settings', function (Blueprint $table) { - $table->dropColumn('show_profile_followers'); - $table->dropColumn('show_profile_follower_count'); - $table->dropColumn('show_profile_following'); - $table->dropColumn('show_profile_following_count'); + $table->dropColumn(['show_profile_followers','show_profile_follower_count','show_profile_following','show_profile_following_count']); }); } } diff --git a/database/migrations/2018_08_27_004653_update_media_table_add_alt_text.php b/database/migrations/2018_08_27_004653_update_media_table_add_alt_text.php index 68ff5a5cd..272ef90f7 100644 --- a/database/migrations/2018_08_27_004653_update_media_table_add_alt_text.php +++ b/database/migrations/2018_08_27_004653_update_media_table_add_alt_text.php @@ -32,13 +32,7 @@ class UpdateMediaTableAddAltText extends Migration public function down() { Schema::table('media', function (Blueprint $table) { - $table->dropColumn('original_sha256'); - $table->dropColumn('optimized_sha256'); - $table->dropColumn('caption'); - $table->dropColumn('hls_path'); - $table->dropColumn('hls_transcoded_at'); - $table->dropColumn('key'); - $table->dropColumn('metadata'); + $table->dropColumn(['original_sha256','optimized_sha256','caption','hls_path','hls_transcoded_at','key','metadata']); }); } } diff --git a/database/migrations/2018_10_17_233623_update_follower_table_add_remote_flags.php b/database/migrations/2018_10_17_233623_update_follower_table_add_remote_flags.php index 7838179de..26e4ea7a7 100644 --- a/database/migrations/2018_10_17_233623_update_follower_table_add_remote_flags.php +++ b/database/migrations/2018_10_17_233623_update_follower_table_add_remote_flags.php @@ -27,8 +27,7 @@ class UpdateFollowerTableAddRemoteFlags extends Migration public function down() { Schema::table('followers', function (Blueprint $table) { - $table->dropColumn('local_profile'); - $table->dropColumn('local_following'); + $table->dropColumn(['local_profile','local_following']); }); } } diff --git a/database/migrations/2018_10_18_035552_update_media_add_alt_text.php b/database/migrations/2018_10_18_035552_update_media_add_alt_text.php index b671b5fcd..3ab198ab6 100644 --- a/database/migrations/2018_10_18_035552_update_media_add_alt_text.php +++ b/database/migrations/2018_10_18_035552_update_media_add_alt_text.php @@ -30,11 +30,7 @@ class UpdateMediaAddAltText extends Migration public function down() { Schema::table('media', function (Blueprint $table) { - $table->dropColumn('license'); - $table->dropColumn('is_nsfw'); - $table->dropColumn('version'); - $table->dropColumn('remote_media'); - $table->dropColumn('remote_url'); + $table->dropColumn(['license','is_nsfw','version','remote_media','remote_url']); }); } } 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 index 3d503c19d..04a88060e 100644 --- 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 @@ -16,10 +16,7 @@ class AddAccountStatusToProfilesTable extends Migration // Drop old columns, fix stories if(Schema::hasColumn('profiles', 'hub_url')) { Schema::table('profiles', function (Blueprint $table) { - $table->dropColumn('verify_token'); - $table->dropColumn('secret'); - $table->dropColumn('salmon_url'); - $table->dropColumn('hub_url'); + $table->dropColumn(['verify_token','secret','salmon_url','hub_url']); }); } diff --git a/database/migrations/2019_01_11_005556_update_profiles_table.php b/database/migrations/2019_01_11_005556_update_profiles_table.php index 53eca4d26..cfb7dbeb5 100644 --- a/database/migrations/2019_01_11_005556_update_profiles_table.php +++ b/database/migrations/2019_01_11_005556_update_profiles_table.php @@ -28,9 +28,7 @@ class UpdateProfilesTable extends Migration public function down() { Schema::table('profiles', function (Blueprint $table) { - $table->dropColumn('unlisted'); - $table->dropColumn('cw'); - $table->dropColumn('no_autolink'); + $table->dropColumn(['unlisted','cw','no_autolink']); }); } } diff --git a/database/migrations/2019_01_12_054413_stories.php b/database/migrations/2019_01_12_054413_stories.php index 2bb160c5a..a61c447de 100644 --- a/database/migrations/2019_01_12_054413_stories.php +++ b/database/migrations/2019_01_12_054413_stories.php @@ -62,12 +62,7 @@ class Stories extends Migration 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'); + $table->dropColumn(['title','preview_photo','local_only','is_live','broadcast_url','broadcast_key']); }); Schema::table('story_reactions', function (Blueprint $table) { diff --git a/database/migrations/2019_02_01_023357_add_remote_to_avatars_table.php b/database/migrations/2019_02_01_023357_add_remote_to_avatars_table.php index e4b064f14..b9e6cf30a 100644 --- a/database/migrations/2019_02_01_023357_add_remote_to_avatars_table.php +++ b/database/migrations/2019_02_01_023357_add_remote_to_avatars_table.php @@ -27,8 +27,7 @@ class AddRemoteToAvatarsTable extends Migration public function down() { Schema::table('avatars', function (Blueprint $table) { - $table->dropColumn('remote_url'); - $table->dropColumn('last_fetched_at'); + $table->dropColumn(['remote_url','last_fetched_at']); }); } } diff --git a/database/migrations/2019_03_31_191216_add_replies_count_to_statuses_table.php b/database/migrations/2019_03_31_191216_add_replies_count_to_statuses_table.php index 2625b984b..cb3e194bf 100644 --- a/database/migrations/2019_03_31_191216_add_replies_count_to_statuses_table.php +++ b/database/migrations/2019_03_31_191216_add_replies_count_to_statuses_table.php @@ -27,8 +27,7 @@ class AddRepliesCountToStatusesTable extends Migration public function down() { Schema::table('statuses', function (Blueprint $table) { - $table->dropColumn('reply_count'); - $table->dropColumn('comments_disabled'); + $table->dropColumn(['reply_count','comments_disabled']); }); } } diff --git a/database/migrations/2019_04_16_184644_add_layout_to_profiles_table.php b/database/migrations/2019_04_16_184644_add_layout_to_profiles_table.php index b0631bed3..ed47eb17c 100644 --- a/database/migrations/2019_04_16_184644_add_layout_to_profiles_table.php +++ b/database/migrations/2019_04_16_184644_add_layout_to_profiles_table.php @@ -32,8 +32,7 @@ class AddLayoutToProfilesTable extends Migration public function down() { Schema::table('profiles', function (Blueprint $table) { - $table->dropColumn('profile_layout'); - $table->dropColumn('post_layout'); + $table->dropColumn(['profile_layout','post_layout']); }); } } diff --git a/database/migrations/2020_04_11_045459_add_fetched_at_to_profiles_table.php b/database/migrations/2020_04_11_045459_add_fetched_at_to_profiles_table.php index de4ce0dcb..b5057092d 100644 --- a/database/migrations/2020_04_11_045459_add_fetched_at_to_profiles_table.php +++ b/database/migrations/2020_04_11_045459_add_fetched_at_to_profiles_table.php @@ -6,39 +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'); - $table->dropColumn('status_count'); - $table->dropColumn('followers_count'); - $table->dropColumn('following_count'); - $table->dropColumn('webfinger'); - $table->dropColumn('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'); + }); + } } diff --git a/database/migrations/2020_08_18_022520_add_remote_url_to_stories_table.php b/database/migrations/2020_08_18_022520_add_remote_url_to_stories_table.php index 25c5e4c87..e1ecdc66a 100644 --- a/database/migrations/2020_08_18_022520_add_remote_url_to_stories_table.php +++ b/database/migrations/2020_08_18_022520_add_remote_url_to_stories_table.php @@ -36,16 +36,10 @@ class AddRemoteUrlToStoriesTable extends Migration public function down() { Schema::table('stories', function (Blueprint $table) { - $table->dropColumn('remote_url'); - $table->dropColumn('media_url'); - $table->dropColumn('is_archived'); - $table->dropColumn('name'); + $table->dropColumn(['remote_url','media_url','is_archived','name']); }); Schema::table('media', function (Blueprint $table) { - $table->dropColumn('blurhash'); - $table->dropColumn('srcset'); - $table->dropColumn('width'); - $table->dropColumn('height'); + $table->dropColumn(['blurhash','srcset','width','height']); }); } } diff --git a/database/migrations/2020_11_14_221947_add_type_to_direct_messages_table.php b/database/migrations/2020_11_14_221947_add_type_to_direct_messages_table.php index 7048d7c4c..cffb29d12 100644 --- a/database/migrations/2020_11_14_221947_add_type_to_direct_messages_table.php +++ b/database/migrations/2020_11_14_221947_add_type_to_direct_messages_table.php @@ -6,31 +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'); - $table->dropColumn('is_hidden'); - $table->dropColumn('meta'); - }); - } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('direct_messages', function (Blueprint $table) { + $table->dropColumn(['type','is_hidden','meta']); + }); + } } diff --git a/database/migrations/2020_12_25_220825_add_status_profile_id_to_likes_table.php b/database/migrations/2020_12_25_220825_add_status_profile_id_to_likes_table.php index 289b19108..ba35157fa 100644 --- a/database/migrations/2020_12_25_220825_add_status_profile_id_to_likes_table.php +++ b/database/migrations/2020_12_25_220825_add_status_profile_id_to_likes_table.php @@ -6,31 +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'); - $table->dropColumn('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); + }); + } } diff --git a/database/migrations/2020_12_27_040951_add_skip_optimize_to_media_table.php b/database/migrations/2020_12_27_040951_add_skip_optimize_to_media_table.php index 4a4553147..7bc56a920 100644 --- a/database/migrations/2020_12_27_040951_add_skip_optimize_to_media_table.php +++ b/database/migrations/2020_12_27_040951_add_skip_optimize_to_media_table.php @@ -6,29 +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'); - $table->dropColumn('replicated_at'); - }); - } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('media', function (Blueprint $table) { + $table->dropColumn(['skip_optimize','replicated_at']); + }); + } } diff --git a/database/migrations/2021_01_25_011355_add_cdn_url_to_avatars_table.php b/database/migrations/2021_01_25_011355_add_cdn_url_to_avatars_table.php index 30793eb87..084285bb6 100644 --- a/database/migrations/2021_01_25_011355_add_cdn_url_to_avatars_table.php +++ b/database/migrations/2021_01_25_011355_add_cdn_url_to_avatars_table.php @@ -6,33 +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'); - $table->dropColumn('size'); - $table->dropColumn('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(); + }); + } }