Update migrations, fixes #4883

This commit is contained in:
Daniel Supernault 2024-01-29 21:45:59 -07:00
parent 6d8ba64e0b
commit 92ff114d2d
No known key found for this signature in database
GPG Key ID: 23740873EE6F76A1
4 changed files with 26 additions and 19 deletions

View File

@ -54,12 +54,14 @@ class AddAccountStatusToProfilesTable extends Migration
$table->string('hub_url')->nullable(); $table->string('hub_url')->nullable();
}); });
Schema::table('stories', function (Blueprint $table) { if (Schema::hasTable('stories')) {
$table->dropColumn('id'); Schema::table('stories', function (Blueprint $table) {
}); $table->dropColumn('id');
Schema::table('stories', function (Blueprint $table) { });
$table->bigIncrements('bigIncrements')->first(); Schema::table('stories', function (Blueprint $table) {
}); $table->bigIncrements('bigIncrements')->first();
});
}
Schema::table('profiles', function (Blueprint $table) { Schema::table('profiles', function (Blueprint $table) {
$table->dropColumn('status'); $table->dropColumn('status');

View File

@ -60,13 +60,7 @@ class Stories extends Migration
{ {
Schema::dropIfExists('story_items'); Schema::dropIfExists('story_items');
Schema::dropIfExists('story_views'); Schema::dropIfExists('story_views');
Schema::dropIfExists('story_reactions');
Schema::table('stories', function (Blueprint $table) { Schema::dropIfExists('stories');
$table->dropColumn(['title','preview_photo','local_only','is_live','broadcast_url','broadcast_key']);
});
Schema::table('story_reactions', function (Blueprint $table) {
$table->dropColumn('story_id');
});
} }
} }

View File

@ -27,6 +27,6 @@ class AddCacheLocksTable extends Migration
*/ */
public function down() public function down()
{ {
Schema::dropTable('cache_locks'); Schema::dropIfExists('cache_locks');
} }
} }

View File

@ -33,14 +33,25 @@ class AddComposeSettingsToUserSettingsTable extends Migration
public function down() public function down()
{ {
Schema::table('user_settings', function (Blueprint $table) { Schema::table('user_settings', function (Blueprint $table) {
$table->dropColumn('compose_settings'); if (Schema::hasColumn('user_settings', 'compose_settings')) {
$table->dropColumn('compose_settings');
}
}); });
Schema::table('media', function (Blueprint $table) { Schema::table('media', function (Blueprint $table) {
$table->string('caption')->change(); $table->string('caption')->change();
$table->dropIndex('profile_id');
$table->dropIndex('mime'); $schemaManager = Schema::getConnection()->getDoctrineSchemaManager();
$table->dropIndex('license'); $indexesFound = $schemaManager->listTableIndexes('media');
if (array_key_exists('media_profile_id_index', $indexesFound)) {
$table->dropIndex('media_profile_id_index');
}
if (array_key_exists('media_mime_index', $indexesFound)) {
$table->dropIndex('media_mime_index');
}
if (array_key_exists('media_license_index', $indexesFound)) {
$table->dropIndex('media_license_index');
}
}); });
} }
} }