<commit_before><?php

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

class CreateDraftsTable extends Migration
{
    public function up()
    {
        $this->schema->create('drafts', function (Blueprint $table) {
            $table->increments('id');
            $table->string('user_id', 256);
            $table->string('server', 64);
            $table->string('node', 256);
            $table->string('nodeid', 192);
            $table->integer('reply_id')->unsigned()->nullable();
            $table->boolean('open')->default(false);
            $table->text('title')->nullable();
            $table->text('content')->nullable();
            $table->timestamps();

            $table->unique(['user_id', 'server', 'node', 'nodeid']);

            $table->foreign('user_id')
                  ->references('id')->on('users')
                  ->onDelete('cascade');

            $table->foreign('reply_id')
                  ->references('id')->on('posts')
                  ->onDelete('cascade');
        });

        $this->schema->create('embeds', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('draft_id')->unsigned();
            $table->text('url');
            $table->integer('imagenumber')->default(0);
            $table->timestamps();

            $table->unique(['draft_id', 'url']);

            $table->foreign('draft_id')
                  ->references('id')->on('drafts')
                  ->onDelete('cascade');
        });
    }

    public function down()
    {
        $this->schema->drop('embeds');
        $this->schema->drop('drafts');
    }<commit_msg>Fix the Drafts migration to work with MySQL Fix #990<commit_after><?php

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

class CreateDraftsTable extends Migration
{
    public function up()
    {
        $this->disableForeignKeyCheck();

        $this->schema->create('drafts', function (Blueprint $table) {
            $table->increments('id');
            $table->string('user_id', 256);
            $table->string('server', 64);
            $table->string('node', 256);
            $table->string('nodeid', 192);
            $table->integer('reply_id')->unsigned()->nullable();
            $table->boolean('open')->default(false);
            $table->text('title')->nullable();
            $table->text('content')->nullable();
            $table->timestamps();

            $table->unique(['user_id', 'server', 'node', 'nodeid']);

            $table->foreign('user_id')
                  ->references('id')->on('users')
                  ->onDelete('cascade');

            $table->foreign('reply_id')
                  ->references('id')->on('posts')
                  ->onDelete('cascade');
        });

        $this->schema->create('embeds', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('draft_id')->unsigned();
            $table->text('url');
            $table->integer('imagenumber')->default(0);
            $table->timestamps();

            $table->foreign('draft_id')
                  ->references('id')->on('drafts')
                  ->onDelete('cascade');

            $table->unique(['draft_id', 'url']);
        });

        $this->enableForeignKeyCheck();
    }

    public function down()
    {
        $this->disableForeignKeyCheck();

        $this->schema->drop('embeds');
        $this->schema->drop('drafts');

        $this->enableForeignKeyCheck();
    }
{'fraction_non_alphanumeric': 0.19577022006287512, 'fraction_numerical': 0.007716490425835953, 'mean_word_length': 2.0647985989492117, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 95, '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': '6886516', 'n_tokens_mistral': 996, 'n_tokens_neox': 940, 'n_words': 131}