Files
newznab-tmux/database/migrations/2020_03_07_213224_remove_text_hash.php
T
2020-03-26 19:59:56 +01:00

41 lines
1.1 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.
*
* @return void
*/
public function up()
{
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.
*
* @return void
*/
public function down()
{
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');
});
}
}