update the new school year model

This commit is contained in:
root
2026-06-07 20:01:58 -04:00
parent 6866aedf42
commit 68a5c9edca
19 changed files with 472 additions and 32 deletions
@@ -0,0 +1,30 @@
<?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
{
if (! Schema::hasTable('subject_curriculum_items') || Schema::hasColumn('subject_curriculum_items', 'school_year')) {
return;
}
Schema::table('subject_curriculum_items', function (Blueprint $table) {
$table->string('school_year', 20)->nullable()->after('class_id')->index();
});
}
public function down(): void
{
if (! Schema::hasTable('subject_curriculum_items') || ! Schema::hasColumn('subject_curriculum_items', 'school_year')) {
return;
}
Schema::table('subject_curriculum_items', function (Blueprint $table) {
$table->dropColumn('school_year');
});
}
};
@@ -0,0 +1,40 @@
<?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
{
if (! Schema::hasTable('class_progress_reports')) {
return;
}
Schema::table('class_progress_reports', function (Blueprint $table) {
if (! Schema::hasColumn('class_progress_reports', 'school_year')) {
$table->string('school_year', 20)->nullable()->after('teacher_id')->index();
}
if (! Schema::hasColumn('class_progress_reports', 'semester')) {
$table->string('semester', 20)->nullable()->after('school_year')->index();
}
});
}
public function down(): void
{
if (! Schema::hasTable('class_progress_reports')) {
return;
}
Schema::table('class_progress_reports', function (Blueprint $table) {
if (Schema::hasColumn('class_progress_reports', 'semester')) {
$table->dropColumn('semester');
}
if (Schema::hasColumn('class_progress_reports', 'school_year')) {
$table->dropColumn('school_year');
}
});
}
};