index name in laravel migration

<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('question_ta', function (Blueprint $table) {
            $table->id(); 
            $table->bigInteger('user_id')->nullable();           
            $table->bigInteger('subject_id')->nullable();
            $table->bigInteger('unit_id')->nullable();
            $table->bigInteger('topic_id')->nullable();
            $table->bigInteger('tag_id')->nullable();
            $table->string('sub_tag',500)->nullable();
            $table->integer('level')->nullable();
            $table->string('class',10)->nullable();
            $table->string('exam',500)->nullable();
            $table->string('exam_type',200)->nullable();
            $table->string('question_type',20)->nullable()->default('subjective');
            $table->text('question_description')->nullable();
            $table->text('question')->nullable();
            $table->string('image',200)->nullable();
            $table->text('assertion')->nullable();
            $table->text('reason')->nullable();
            $table->text('statement1')->nullable();
            $table->text('statement2')->nullable();
            $table->text('conclusion1')->nullable();
            $table->text('conclusion2')->nullable();
            $table->text('conclusion3')->nullable();
            $table->text('conclusion4')->nullable();
            $table->integer('complexity')->nullable()->default('10');
            $table->string('answer',5)->nullable();
            $table->tinyInteger('multi_correct')->nullable()->default('0');
            $table->text('option1')->nullable();
            $table->text('option2')->nullable();
            $table->text('option3')->nullable();
            $table->text('option4')->nullable();
            $table->text('option5')->nullable();
            $table->string('image1',200)->nullable();
            $table->string('image2',200)->nullable();
            $table->string('image3',200)->nullable();
            $table->string('image4',200)->nullable();
            $table->string('image5',200)->nullable();
            $table->integer('marks')->nullable();
            $table->text('hint')->nullable();
            $table->text('concept')->nullable();
            $table->text('solution')->nullable();
            $table->string('solution_image',200)->nullable();
            $table->string('solution_video',500)->nullable();
            $table->string('start',10)->nullable();
            $table->string('end',10)->nullable();
            $table->text('note')->nullable();
            $table->string('created_by',1000)->nullable();
            $table->string('edited_by',1000)->nullable();
            $table->string('exam_name',200)->nullable();
            $table->string('exam_year',200)->nullable();
            $table->timestamp('last_edited')->nullable();  
            $table->string('question_catId',200)->nullable();
            $table->string('source',200)->nullable();
            $table->string('chapter_no',100)->nullable();
            $table->double('question_no', 8, 2)->nullable();
            $table->string('paper_no',100)->nullable();
            $table->string('mock_test_no',100)->nullable();
            $table->softDeletes();
            $table->timestamps();
            $table->index(['subject_id', 'unit_id','topic_id','level','tag_id','sub_tag','class','exam','exam_type','question_type'],'subject_and_ids');
        
        });
    }

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


Leave a Reply