<commit_before><commit_msg>Add indexes to artwork_term table via migration<commit_after><?php

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

class AddArtworkTermIndexes extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {

        Schema::table('artwork_term', function (Blueprint $table) {

            // Remove auto-generated index by name
            $table->dropIndex('artwork_citi_id');

            $table->increments('id')->first();
            $table->index('artwork_citi_id');
            $table->index('term_citi_id');
            $table->index('preferred');

        });

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {

        Schema::table('artwork_term', function (Blueprint $table) {

            $table->dropColumn('id');

            // Using an array of column names makes it target the generated index names
            $table->dropIndex(['artwork_citi_id']);
            $table->dropIndex(['term_citi_id']);
            $table->dropIndex(['preferred']);

            // Silly, but it seems Laravel auto-generated this for us...
            $table->index(['artwork_citi_id','term_citi_id'],'artwork_citi_id');

        });

    }
}
{'fraction_non_alphanumeric': 0.13596491228070176, 'fraction_numerical': 0.0, 'mean_word_length': 2.3228155339805827, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3402767', 'n_tokens_mistral': 397, 'n_tokens_neox': 390, 'n_words': 78}