bổ sung migrate
This commit is contained in:
		
							parent
							
								
									1de318b86e
								
							
						
					
					
						commit
						b599316f57
					
				| 
						 | 
				
			
			@ -0,0 +1,31 @@
 | 
			
		|||
<?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()
 | 
			
		||||
    {
 | 
			
		||||
        Schema::create('technicals', function (Blueprint $table) {
 | 
			
		||||
            $table->id();
 | 
			
		||||
            $table->string('name');
 | 
			
		||||
            $table->unsignedTinyInteger('level')->nullable(); // Level từ 1-3, cho phép null
 | 
			
		||||
            $table->timestamps();
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Reverse the migrations.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function down()
 | 
			
		||||
    {
 | 
			
		||||
        Schema::dropIfExists('technicals');
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Run the migrations.
 | 
			
		||||
     */
 | 
			
		||||
    public function up()
 | 
			
		||||
    {
 | 
			
		||||
        Schema::create('technicals_users', function (Blueprint $table) {
 | 
			
		||||
            $table->id();
 | 
			
		||||
            $table->foreignId('user_id')->constrained('users')->onDelete('cascade'); // Khóa ngoại tới bảng users
 | 
			
		||||
            $table->foreignId('technical_id')->constrained('technicals')->onDelete('cascade'); // Khóa ngoại tới bảng technicals
 | 
			
		||||
            $table->unsignedTinyInteger('point')->default(0); // Điểm từ 0-3, mặc định 0
 | 
			
		||||
            $table->timestamps();
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Reverse the migrations.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function down()
 | 
			
		||||
    {
 | 
			
		||||
        Schema::dropIfExists('technicals_users');
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -29,7 +29,7 @@ interface TableRow {
 | 
			
		|||
  criteria: string
 | 
			
		||||
  note: string
 | 
			
		||||
  createdBy: string
 | 
			
		||||
  point: string
 | 
			
		||||
  point: number
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
interface ExpandedProjects {
 | 
			
		||||
| 
						 | 
				
			
			@ -62,7 +62,7 @@ const CriteriaTable = ({ data }: { data: TableRow[] }) => (
 | 
			
		|||
          <Table.Td style={{ textAlign: 'start' }}>{row.criteria}</Table.Td>
 | 
			
		||||
          <Table.Td style={{ textAlign: 'start' }}>{row.note}</Table.Td>
 | 
			
		||||
          <Table.Td style={{ textAlign: 'start' }}>{row.createdBy}</Table.Td>
 | 
			
		||||
          <Table.Td>{row.point}</Table.Td>
 | 
			
		||||
          <Table.Td>{row.point == 0 ? '' : row.point}</Table.Td>
 | 
			
		||||
        </Table.Tr>
 | 
			
		||||
      ))}
 | 
			
		||||
    </Table.Tbody>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue