parent
55c47d4842
commit
70eb021c6b
11 changed files with 313 additions and 0 deletions
@ -0,0 +1,25 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Database\Migrations\Migration; |
||||
use Illuminate\Database\Schema\Blueprint; |
||||
use Illuminate\Support\Facades\Schema; |
||||
|
||||
return new class extends Migration { |
||||
public function up(): void |
||||
{ |
||||
Schema::create('se_subjects', function (Blueprint $table) { |
||||
$table->id(); |
||||
$table->string('name'); |
||||
$table->string('code')->unique(); |
||||
$table->text('description')->nullable(); |
||||
$table->integer('status')->default(1); // true = active, false = inactive |
||||
$table->timestamps(); |
||||
$table->softDeletes(); // deleted_at |
||||
}); |
||||
} |
||||
|
||||
public function down(): void |
||||
{ |
||||
Schema::dropIfExists('se_subjects'); |
||||
} |
||||
}; |
@ -0,0 +1,25 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Database\Migrations\Migration; |
||||
use Illuminate\Database\Schema\Blueprint; |
||||
use Illuminate\Support\Facades\Schema; |
||||
|
||||
return new class extends Migration { |
||||
public function up(): void |
||||
{ |
||||
Schema::create('se_categories', function (Blueprint $table) { |
||||
$table->id(); |
||||
$table->string('content'); |
||||
$table->string('content_vi')->nullable(); |
||||
$table->text('description')->nullable(); |
||||
$table->integer('status')->default(1); |
||||
$table->timestamps(); |
||||
$table->softDeletes(); |
||||
}); |
||||
} |
||||
|
||||
public function down(): void |
||||
{ |
||||
Schema::dropIfExists('se_categories'); |
||||
} |
||||
}; |
@ -0,0 +1,24 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Database\Migrations\Migration; |
||||
use Illuminate\Database\Schema\Blueprint; |
||||
use Illuminate\Support\Facades\Schema; |
||||
|
||||
return new class extends Migration { |
||||
public function up(): void |
||||
{ |
||||
Schema::create('se_skills', function (Blueprint $table) { |
||||
$table->id(); |
||||
$table->string('name'); |
||||
$table->string('code')->unique(); |
||||
$table->text('description')->nullable(); |
||||
$table->timestamps(); |
||||
$table->softDeletes(); |
||||
}); |
||||
} |
||||
|
||||
public function down(): void |
||||
{ |
||||
Schema::dropIfExists('se_skills'); |
||||
} |
||||
}; |
@ -0,0 +1,25 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Database\Migrations\Migration; |
||||
use Illuminate\Database\Schema\Blueprint; |
||||
use Illuminate\Support\Facades\Schema; |
||||
|
||||
return new class extends Migration { |
||||
public function up(): void |
||||
{ |
||||
Schema::create('se_question_types', function (Blueprint $table) { |
||||
$table->id(); |
||||
$table->string('name'); |
||||
$table->text('description')->nullable(); |
||||
$table->string('code')->unique(); |
||||
$table->integer('status')->default(1); |
||||
$table->timestamps(); |
||||
$table->softDeletes(); |
||||
}); |
||||
} |
||||
|
||||
public function down(): void |
||||
{ |
||||
Schema::dropIfExists('se_question_types'); |
||||
} |
||||
}; |
@ -0,0 +1,28 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Database\Migrations\Migration; |
||||
use Illuminate\Database\Schema\Blueprint; |
||||
use Illuminate\Support\Facades\Schema; |
||||
|
||||
return new class extends Migration { |
||||
public function up(): void |
||||
{ |
||||
Schema::create('se_media', function (Blueprint $table) { |
||||
$table->id(); |
||||
// Nếu muốn polymorphic, bạn nên thêm $table->string('object_type') để phân biệt loại object |
||||
$table->unsignedBigInteger('object_id'); |
||||
$table->string('file_name'); |
||||
$table->string('file_url'); |
||||
$table->string('mime_type'); |
||||
$table->unsignedBigInteger('size_bytes'); |
||||
$table->integer('position')->nullable(); |
||||
$table->timestamps(); |
||||
$table->softDeletes(); |
||||
}); |
||||
} |
||||
|
||||
public function down(): void |
||||
{ |
||||
Schema::dropIfExists('se_media'); |
||||
} |
||||
}; |
@ -0,0 +1,34 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Database\Migrations\Migration; |
||||
use Illuminate\Database\Schema\Blueprint; |
||||
use Illuminate\Support\Facades\Schema; |
||||
|
||||
return new class extends Migration { |
||||
public function up(): void |
||||
{ |
||||
Schema::create('se_exercises', function (Blueprint $table) { |
||||
$table->id(); |
||||
|
||||
// Chỉ giữ tên cột, không ràng buộc FK |
||||
$table->unsignedBigInteger('subject_id'); |
||||
$table->string('lesson_name'); |
||||
$table->text('description')->nullable(); |
||||
$table->integer('level')->default(0); |
||||
$table->string('avatar')->nullable(); |
||||
$table->integer('status')->default(1); // true = active, false = inactive |
||||
$table->unsignedBigInteger('category_id'); |
||||
$table->unsignedBigInteger('skill_id'); |
||||
$table->integer('year')->nullable(); |
||||
$table->unsignedBigInteger('media_object_id')->nullable(); |
||||
|
||||
$table->timestamps(); |
||||
$table->softDeletes(); |
||||
}); |
||||
} |
||||
|
||||
public function down(): void |
||||
{ |
||||
Schema::dropIfExists('se_exercises'); |
||||
} |
||||
}; |
@ -0,0 +1,32 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Database\Migrations\Migration; |
||||
use Illuminate\Database\Schema\Blueprint; |
||||
use Illuminate\Support\Facades\Schema; |
||||
|
||||
return new class extends Migration { |
||||
public function up(): void |
||||
{ |
||||
Schema::create('se_question_groups', function (Blueprint $table) { |
||||
$table->id(); |
||||
$table->text('content'); |
||||
$table->text('content_vi')->nullable(); |
||||
$table->unsignedBigInteger('exercise_id'); |
||||
|
||||
$table->integer('is_question_order_fixed')->default(0); |
||||
$table->integer('is_option_order_fixed')->default(0); |
||||
$table->integer('position')->default(0); |
||||
$table->text('paragraph')->nullable(); |
||||
$table->unsignedBigInteger('media_object_id')->nullable(); |
||||
|
||||
$table->timestamps(); |
||||
$table->softDeletes(); |
||||
|
||||
}); |
||||
} |
||||
|
||||
public function down(): void |
||||
{ |
||||
Schema::dropIfExists('se_question_groups'); |
||||
} |
||||
}; |
@ -0,0 +1,36 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Database\Migrations\Migration; |
||||
use Illuminate\Database\Schema\Blueprint; |
||||
use Illuminate\Support\Facades\Schema; |
||||
|
||||
return new class extends Migration { |
||||
public function up(): void |
||||
{ |
||||
Schema::create('se_questions', function (Blueprint $table) { |
||||
$table->id(); |
||||
|
||||
// Các cột FK giờ chỉ giữ tên, không còn ràng buộc |
||||
$table->unsignedBigInteger('exercise_id'); |
||||
$table->text('content'); |
||||
$table->text('description')->nullable(); |
||||
$table->unsignedBigInteger('group_id')->nullable(); |
||||
$table->unsignedBigInteger('question_type_id'); |
||||
$table->integer('level')->default(0); |
||||
$table->integer('score')->default(1); |
||||
$table->text('answer')->nullable(); |
||||
$table->text('explanation')->nullable(); |
||||
$table->text('hint')->nullable(); |
||||
$table->unsignedBigInteger('media_object_id')->nullable(); |
||||
|
||||
$table->timestamps(); |
||||
$table->softDeletes(); |
||||
|
||||
}); |
||||
} |
||||
|
||||
public function down(): void |
||||
{ |
||||
Schema::dropIfExists('se_questions'); |
||||
} |
||||
}; |
@ -0,0 +1,27 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Database\Migrations\Migration; |
||||
use Illuminate\Database\Schema\Blueprint; |
||||
use Illuminate\Support\Facades\Schema; |
||||
|
||||
return new class extends Migration { |
||||
public function up(): void |
||||
{ |
||||
Schema::create('se_exercise_questions', function (Blueprint $table) { |
||||
$table->id(); |
||||
|
||||
$table->unsignedBigInteger('exercise_id'); |
||||
$table->unsignedBigInteger('question_id'); |
||||
$table->integer('position')->default(0); |
||||
|
||||
$table->timestamps(); |
||||
$table->softDeletes(); |
||||
|
||||
}); |
||||
} |
||||
|
||||
public function down(): void |
||||
{ |
||||
Schema::dropIfExists('se_exercise_questions'); |
||||
} |
||||
}; |
@ -0,0 +1,32 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Database\Migrations\Migration; |
||||
use Illuminate\Database\Schema\Blueprint; |
||||
use Illuminate\Support\Facades\Schema; |
||||
|
||||
return new class extends Migration { |
||||
public function up(): void |
||||
{ |
||||
Schema::create('se_question_choices', function (Blueprint $table) { |
||||
$table->id(); |
||||
|
||||
// Chỉ giữ cột, không còn ràng buộc FK |
||||
$table->unsignedBigInteger('question_id'); |
||||
$table->string('label')->nullable(); |
||||
$table->text('content')->nullable(); |
||||
$table->integer('is_correct')->default(0); // 0 = false, 1 = true |
||||
$table->json('media')->nullable(); |
||||
$table->unsignedBigInteger('media_object_id')->nullable(); |
||||
$table->integer('position')->default(0); |
||||
|
||||
$table->timestamps(); |
||||
$table->softDeletes(); |
||||
|
||||
}); |
||||
} |
||||
|
||||
public function down(): void |
||||
{ |
||||
Schema::dropIfExists('se_question_choices'); |
||||
} |
||||
}; |
@ -0,0 +1,25 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Database\Migrations\Migration; |
||||
use Illuminate\Database\Schema\Blueprint; |
||||
use Illuminate\Support\Facades\Schema; |
||||
|
||||
return new class extends Migration { |
||||
public function up(): void |
||||
{ |
||||
Schema::create('se_question_blanks', function (Blueprint $table) { |
||||
$table->id(); |
||||
$table->unsignedBigInteger('question_id'); |
||||
$table->integer('position')->default(0); |
||||
$table->text('correct_answer'); |
||||
$table->json('other_answers')->nullable(); |
||||
$table->timestamps(); |
||||
$table->softDeletes(); |
||||
}); |
||||
} |
||||
|
||||
public function down(): void |
||||
{ |
||||
Schema::dropIfExists('se_question_blanks'); |
||||
} |
||||
}; |
Loading…
Reference in new issue