<commit_before><?php

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

class CreateItemTranslationsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('item_translations', function (Blueprint $table) 
        {
            $table->increments('id');
            $table->string('item_id');
            $table->string('locale')->index();
            
            // translatable attributes
            $table->string('title');
            $table->string('description');
            $table->string('work_type');
            $table->string('work_level');
            $table->string('topic');
            $table->string('subject');
            $table->string('measurement');
            $table->string('dating');
            $table->string('medium');
            $table->string('technique');
            $table->string('inscription');
            $table->string('place')->nullable();
            $table->string('state_edition')->nullable();
            $table->string('gallery');
            $table->string('relationship_type')->nullable();
            $table->string('related_work')->nullable();
            $table->string('description_source');

            $table->unique(['item_id','locale']);
            $table->foreign('item_id')->references('id')->on('items')->onDelete('cascade');
        });

        $default_locale = App::getLocale();

        DB::table('items')->orderBy('id')->chunk(100, function($items) use ($default_locale) {
            $item_translations = [];
            foreach ($items as $item) {
                $item_translations[] = [
                    'item_id'            => $item->id,
                    'locale'             => $default_locale,
                    'title'              => $item->title,
                    'description'        => $item->description,
                    'work_type'          => $item->work_type,
                    'work_level'         => $item->work_level,
                    'topic'              => $item->topic,
                    'subject'            => $item->subject,
                    'measurement'        => $item->measurement,
                    'dating'             => $item->dating,
                    'medium'             => $item->medium,
                    'technique'          => $item->technique,
                    'inscription'        => $item->inscription,
                    'place'              => $item->place,
                    'state_edition'      => $item->state_edition,
                    'gallery'            => $item->gallery,
                    'relationship_type'  => $item->relationship_type,
                    'related_work'       => $item->related_work,
                    'description_source' => $item->description_source,
                ];
            }

            DB::table('item_translations')->insert( $item_translations );
        });
        
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('item_translations');
    }
}
<commit_msg>fix item description length<commit_after><?php

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

class CreateItemTranslationsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('item_translations', function (Blueprint $table) 
        {
            $table->increments('id');
            $table->string('item_id');
            $table->string('locale')->index();
            
            // translatable attributes
            $table->string('title');
            $table->mediumText('description');
            $table->string('work_type');
            $table->string('work_level');
            $table->string('topic');
            $table->string('subject');
            $table->string('measurement');
            $table->string('dating');
            $table->string('medium');
            $table->string('technique');
            $table->string('inscription');
            $table->string('place')->nullable();
            $table->string('state_edition')->nullable();
            $table->string('gallery');
            $table->string('relationship_type')->nullable();
            $table->string('related_work')->nullable();
            $table->string('description_source');

            $table->unique(['item_id','locale']);
            $table->foreign('item_id')->references('id')->on('items')->onDelete('cascade');
        });

        $default_locale = App::getLocale();

        DB::table('items')->orderBy('id')->chunk(100, function($items) use ($default_locale) {
            $item_translations = [];
            foreach ($items as $item) {
                $item_translations[] = [
                    'item_id'            => $item->id,
                    'locale'             => $default_locale,
                    'title'              => $item->title,
                    'description'        => $item->description,
                    'work_type'          => $item->work_type,
                    'work_level'         => $item->work_level,
                    'topic'              => $item->topic,
                    'subject'            => $item->subject,
                    'measurement'        => $item->measurement,
                    'dating'             => $item->dating,
                    'medium'             => $item->medium,
                    'technique'          => $item->technique,
                    'inscription'        => $item->inscription,
                    'place'              => $item->place,
                    'state_edition'      => $item->state_edition,
                    'gallery'            => $item->gallery,
                    'relationship_type'  => $item->relationship_type,
                    'related_work'       => $item->related_work,
                    'description_source' => $item->description_source,
                ];
            }

            DB::table('item_translations')->insert( $item_translations );
        });
        
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('item_translations');
    }
}

{'fraction_non_alphanumeric': 0.15555555555555556, 'fraction_numerical': 0.0009389671361502347, 'mean_word_length': 1.490646921278254, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 143, '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': '5937782', 'n_tokens_mistral': 1623, 'n_tokens_neox': 1586, 'n_words': 215}