Skip to content

Commit

Permalink
added md5 hash search to API as type "hash"
Browse files Browse the repository at this point in the history
  • Loading branch information
Byorun committed Jul 11, 2018
1 parent 4591793 commit 7c74cd3
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/SongListComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ protected function searchableKeys()
'author' => 'sd.author_name',
'name' => 's.name',
'user' => 'u.name',
'hash' => 'sd.hash_md5',
'song' => ['sd.song_name', 'sd.song_sub_name'],
'all' => ['sd.song_name', 'sd.song_sub_name', 'sd.author_name', 's.name', 'u.name'],
];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddHashIndexToSongDetails extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('song_details', function (Blueprint $table) {
$table->index(['hash_md5', 'hash_sha1']);
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('song_details', function (Blueprint $table) {
$table->dropIndex(['hash_md5', 'hash_sha1']);
});
}
}

0 comments on commit 7c74cd3

Please sign in to comment.