<commit_before><?php

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

class RenameEmailFrequencyToEmailSubscriptionStatus extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        $this->renameField('users', 'email_frequency', 'email_subscription_status');
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        $this->renameField('users', 'email_subscription_status', 'email_frequency');
    }

     /**
     * Rename the given field on any documents in the collection.
     *
     * @param string $collection
     * @param string $old
     * @param string $new
     */
    public function renameField($collection, $old, $new)
    {
        /** @var \Jenssegers\Mongodb\Connection $connection */
        $connection = app('db')->connection('mongodb');

        $connection->collection($collection)
            ->whereRaw([$old => ['$exists' => true]])
            ->update(['$rename' => [$old => $new]]);
    }
}<commit_msg>Style<commit_after><?php

use Illuminate\Database\Migrations\Migration;

class RenameEmailFrequencyToEmailSubscriptionStatus extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        $this->renameField('users', 'email_frequency', 'email_subscription_status');
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        $this->renameField('users', 'email_subscription_status', 'email_frequency');
    }

    /**
     * Rename the given field on any documents in the collection.
     *
     * @param string $collection
     * @param string $old
     * @param string $new
     */
    public function renameField($collection, $old, $new)
    {
        /** @var \Jenssegers\Mongodb\Connection $connection */
        $connection = app('db')->connection('mongodb');

        $connection->collection($collection)
            ->whereRaw([$old => ['$exists' => true]])
            ->update(['$rename' => [$old => $new]]);
    }
}
{'fraction_non_alphanumeric': 0.14571948998178508, 'fraction_numerical': 0.0, 'mean_word_length': 2.5208333333333335, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '7395927', 'n_tokens_mistral': 631, 'n_tokens_neox': 639, 'n_words': 134}