<commit_before><?php

/*
 * This file is part of santakani.com
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

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

/**
 * CreateImageTable
 *
 * Database migration to create "image" table. This table store metadata of
 * uploaded images. Current schema only supports images. In future it might
 * support audio and video if needed.
 *
 * @author <NAME> <<EMAIL>>
 * @see https://github.com/santakani/santakani.com/wiki/Image
 */

class CreateImageTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('image', function (Blueprint $table) {
            $table->increments('id');

            // MIME type used to validate file content and decide file extension
            // Support image/jpeg, image/png, image/gif
            $table->string('mime_type');

            // Original width and height. Detect if it has large and medium sizes
            // generated.
            $table->integer('width')->unsigned()->nullable();
            $table->integer('height')->unsigned()->nullable();

            // Who uploaded this image. Users might want to reuse their images.
            $table->integer('user_id')->unsigned()->nullable()->index();

            // Parent model type and id. Use Laravel Polymorphic relationships
            // "parent_type" can be "designer", "place", "country", "city"
            $table->string('parent_type')->nullable();
            $table->integer('parent_id')->unsigned()->nullable();

            // Timestamps
            $table->timestamps();
            $table->softDeletes();

            // Index
            $table->index(['parent_type', 'parent_id']);

            // Foreign key
            $table->foreign('user_id')->references('id')->on('user')->onDelete('set null');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('image');
    }
}
<commit_msg>Commnet image table migration.<commit_after><?php

/*
 * This file is part of santakani.com
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

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

/**
 * CreateImageTable
 *
 * Database migration to create "image" table. This table store metadata of
 * uploaded images. Current schema only supports images. In future it might
 * support audio and video if needed.
 *
 * @author <NAME> <<EMAIL>>
 * @see https://github.com/santakani/santakani.com/wiki/Image
 */

class CreateImageTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('image', function (Blueprint $table) {
            $table->increments('id');

            $table->string('mime_type'); // image/jpeg, image/png, image/gif
            $table->integer('width')->unsigned()->nullable(); // Original width
            $table->integer('height')->unsigned()->nullable(); // Original height

            $table->integer('user_id')->unsigned()->nullable()->index();
            $table->string('parent_type')->nullable(); // Polymorphic relationship
            $table->integer('parent_id')->unsigned()->nullable();

            $table->timestamps();
            $table->softDeletes();

            $table->index(['parent_type', 'parent_id']);

            $table->foreign('user_id')->references('id')->on('user')->onDelete('set null');
        });
    }

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

{'fraction_non_alphanumeric': 0.15003808073115005, 'fraction_numerical': 0.0, 'mean_word_length': 2.43804537521815, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 63, 'https://': 2, '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': '935286', 'n_tokens_mistral': 1067, 'n_tokens_neox': 1058, 'n_words': 281}