Files
newznab-tmux/database/migrations/2020_03_07_213224_remove_text_hash.php
T
2023-03-30 14:15:45 +00:00

37 lines
1.0 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class RemoveTextHash extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('release_comments', function (Blueprint $table) {
$sm = Schema::getConnection()->getDoctrineSchemaManager();
$indexesFound = $sm->listTableIndexes('release_comments');
if (array_key_exists('ix_release_comments_hash_releases_id', $indexesFound)) {
$table->dropUnique('ix_release_comments_hash_releases_id');
}
$table->dropColumn('text_hash');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('release_comments', function (Blueprint $table) {
$table->string('text_hash', 32)->default('');
$table->unique(['text_hash', 'releases_id'], 'ix_release_comments_hash_releases_id');
});
}
}