<commit_before><?php

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

class NextVersion extends Migration
{
    public function up()
    {
        // Purge soft deletes records
        if (! app()->runningUnitTests()) {
            DB::table('forum_replies')
                ->join('forum_threads', 'forum_replies.thread_id', '=', 'forum_threads.id')
                ->whereNotNull('forum_threads.deleted_at')
                ->delete();
            DB::table('tagged_items')
                ->join('forum_threads', 'tagged_items.thread_id', '=', 'forum_threads.id')
                ->whereNotNull('forum_threads.deleted_at')
                ->delete();
            DB::table('forum_threads')->whereNotNull('deleted_at')->delete();
            DB::table('forum_replies')->whereNotNull('deleted_at')->delete();
            DB::table('users')->whereNotNull('deleted_at')->delete();
            DB::table('tagged_items')->whereRaw('thread_id NOT IN (SELECT id FROM forum_threads)')->delete();
            DB::table('forum_threads')
                ->whereRaw('solution_reply_id NOT IN (SELECT id FROM forum_replies)')
                ->update(['solution_reply_id' => null]);
        }

        // Create password_resets table
        Schema::create('password_resets', function (Blueprint $table) {
            $table->string('email')->index();
            $table->string('token');
            $table->timestamp('created_at')->nullable();
        });

        // Clean up users
        Schema::table('users', function(Blueprint $table) {
            $table->string('email')->unique()->change();
            $table->string('username', 40)->default('');
            $table->string('password')->default('');
            $table->smallInteger('type', false, true)->default(User::DEFAULT);
            $table->dateTime('created_at')->nullable()->default(NULL)->change();<commit_msg>Don't reference App classes in migrations<commit_after><?php

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

class NextVersion extends Migration
{
    public function up()
    {
        // Purge soft deletes records
        if (! app()->runningUnitTests()) {
            DB::table('forum_replies')
                ->join('forum_threads', 'forum_replies.thread_id', '=', 'forum_threads.id')
                ->whereNotNull('forum_threads.deleted_at')
                ->delete();
            DB::table('tagged_items')
                ->join('forum_threads', 'tagged_items.thread_id', '=', 'forum_threads.id')
                ->whereNotNull('forum_threads.deleted_at')
                ->delete();
            DB::table('forum_threads')->whereNotNull('deleted_at')->delete();
            DB::table('forum_replies')->whereNotNull('deleted_at')->delete();
            DB::table('users')->whereNotNull('deleted_at')->delete();
            DB::table('tagged_items')->whereRaw('thread_id NOT IN (SELECT id FROM forum_threads)')->delete();
            DB::table('forum_threads')
                ->whereRaw('solution_reply_id NOT IN (SELECT id FROM forum_replies)')
                ->update(['solution_reply_id' => null]);
        }

        // Create password_resets table
        Schema::create('password_resets', function (Blueprint $table) {
            $table->string('email')->index();
            $table->string('token');
            $table->timestamp('created_at')->nullable();
        });

        // Clean up users
        Schema::table('users', function(Blueprint $table) {
            $table->string('email')->unique()->change();
            $table->string('username', 40)->default('');
            $table->string('password')->default('');
            $table->smallInteger('type', false, true)->default(1);
            $table->dateTime('created_at')->nullable()->default(NULL)->change();
{'fraction_non_alphanumeric': 0.17361464158617185, 'fraction_numerical': 0.0012709710218607015, 'mean_word_length': 2.687910028116214, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 75, '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': '7055165', 'n_tokens_mistral': 1066, 'n_tokens_neox': 1045, 'n_words': 158}