add migration table

master
sundayenglish 3 weeks ago
parent 70eb021c6b
commit a00793bcdb
  1. 1
      database/migrations/2025_06_26_035908_create_se_media_table.php
  2. 5
      database/migrations/2025_06_26_035927_create_se_exercises_table.php
  3. 2
      database/migrations/2025_06_26_040033_create_se_questions_table.php
  4. 2
      database/migrations/2025_06_26_040122_create_se_question_choices_table.php

@ -9,7 +9,6 @@ return new class extends Migration {
{ {
Schema::create('se_media', function (Blueprint $table) { Schema::create('se_media', function (Blueprint $table) {
$table->id(); $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->unsignedBigInteger('object_id');
$table->string('file_name'); $table->string('file_name');
$table->string('file_url'); $table->string('file_url');

@ -10,16 +10,15 @@ return new class extends Migration {
Schema::create('se_exercises', function (Blueprint $table) { Schema::create('se_exercises', function (Blueprint $table) {
$table->id(); $table->id();
// Chỉ giữ tên cột, không ràng buộc FK
$table->unsignedBigInteger('subject_id'); $table->unsignedBigInteger('subject_id');
$table->string('lesson_name'); $table->string('lesson_name');
$table->text('description')->nullable(); $table->text('description')->nullable();
$table->integer('level')->default(0); $table->integer('level')->default(0);
$table->string('avatar')->nullable(); $table->string('avatar')->nullable();
$table->integer('status')->default(1); // true = active, false = inactive $table->integer('status')->default(1); //
$table->unsignedBigInteger('category_id'); $table->unsignedBigInteger('category_id');
$table->unsignedBigInteger('skill_id'); $table->unsignedBigInteger('skill_id');
$table->integer('year')->nullable(); $table->string('year')->nullable();
$table->unsignedBigInteger('media_object_id')->nullable(); $table->unsignedBigInteger('media_object_id')->nullable();
$table->timestamps(); $table->timestamps();

@ -9,8 +9,6 @@ return new class extends Migration {
{ {
Schema::create('se_questions', function (Blueprint $table) { Schema::create('se_questions', function (Blueprint $table) {
$table->id(); $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->unsignedBigInteger('exercise_id');
$table->text('content'); $table->text('content');
$table->text('description')->nullable(); $table->text('description')->nullable();

@ -15,7 +15,7 @@ return new class extends Migration {
$table->string('label')->nullable(); $table->string('label')->nullable();
$table->text('content')->nullable(); $table->text('content')->nullable();
$table->integer('is_correct')->default(0); // 0 = false, 1 = true $table->integer('is_correct')->default(0); // 0 = false, 1 = true
$table->json('media')->nullable(); // $table->json('media')->nullable();
$table->unsignedBigInteger('media_object_id')->nullable(); $table->unsignedBigInteger('media_object_id')->nullable();
$table->integer('position')->default(0); $table->integer('position')->default(0);

Loading…
Cancel
Save