Fix: Исправлена миграция course_requests
✅ Правильная структура таблиц ✅ Все поля: organization_id, user_id, group_id, start_date, end_date Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
parent
4e38a11490
commit
2a42403471
|
|
@ -6,22 +6,39 @@ use Illuminate\Support\Facades\Schema;
|
|||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('course_requests_tables', function (Blueprint $table) {
|
||||
Schema::create('course_requests', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('organization_id')->nullable()->constrained()->onDelete('cascade');
|
||||
$table->foreignId('requested_by_user_id')->constrained('users')->onDelete('cascade');
|
||||
$table->enum('status', ['pending', 'approved', 'rejected'])->default('pending');
|
||||
$table->foreignId('approved_by')->nullable()->constrained('users')->onDelete('set null');
|
||||
$table->timestamp('approved_at')->nullable();
|
||||
$table->text('note')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['status', 'created_at']);
|
||||
});
|
||||
|
||||
Schema::create('course_request_items', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('course_request_id')->constrained()->onDelete('cascade');
|
||||
$table->foreignId('course_id')->constrained()->onDelete('cascade');
|
||||
$table->foreignId('organization_id')->nullable()->constrained()->onDelete('cascade');
|
||||
$table->foreignId('user_id')->nullable()->constrained()->onDelete('cascade');
|
||||
$table->foreignId('group_id')->nullable()->constrained()->onDelete('cascade');
|
||||
$table->date('start_date');
|
||||
$table->date('end_date')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index('course_request_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('course_requests_tables');
|
||||
Schema::dropIfExists('course_request_items');
|
||||
Schema::dropIfExists('course_requests');
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,28 +0,0 @@
|
|||
<?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::table('course_request_items', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('course_request_items', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
};
|
||||
Loading…
Reference in New Issue