update the new school year model
This commit is contained in:
@@ -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');
|
||||
});
|
||||
}
|
||||
};
|
||||
+40
@@ -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');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user