fix first production issues
API CI/CD / Validate (composer + pint) (push) Failing after 1m11s
API CI/CD / Test (PHPUnit) (push) Failing after 2m30s
API CI/CD / Build frontend assets (push) Successful in 1m14s
API CI/CD / Security audit (push) Failing after 48s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped

This commit is contained in:
root
2026-07-10 03:43:50 -04:00
parent 02ba2fe6b6
commit e9c10ae376
11 changed files with 687 additions and 564 deletions
@@ -29,12 +29,15 @@ return new class extends Migration
if (! Schema::hasColumn('school_years', 'reopened_at')) {
$table->timestamp('reopened_at')->nullable()->after('closed_by');
}
if (! Schema::hasColumn('school_years', 'reopened_by')) {
$table->unsignedBigInteger('reopened_by')->nullable()->after('reopened_at');
}
if (! Schema::hasColumn('school_years', 'archived_at')) {
$table->timestamp('archived_at')->nullable()->after('reopened_by');
}
if (! Schema::hasColumn('school_years', 'archived_by')) {
$table->unsignedBigInteger('archived_by')->nullable()->after('archived_at');
}
@@ -51,9 +54,21 @@ return new class extends Migration
$table->string('status', 30)->default('enrolled')->index();
$table->unsignedBigInteger('promoted_from_enrollment_id')->nullable();
$table->timestamps();
$table->unique(['student_id', 'school_year_id'], 'uniq_student_year');
$table->index('school_year_id', 'idx_enrollment_school_year');
$table->index('student_id', 'idx_enrollment_student');
$table->unique(
['student_id', 'school_year_id'],
'uniq_student_year'
);
$table->index(
'school_year_id',
'idx_enrollment_school_year'
);
$table->index(
'student_id',
'idx_enrollment_student'
);
});
}
@@ -66,14 +81,27 @@ return new class extends Migration
$table->decimal('opening_balance', 12, 2)->default(0);
$table->decimal('current_balance', 12, 2)->default(0);
$table->timestamps();
$table->unique(['parent_id', 'school_year'], 'uniq_parent_school_year_name');
$table->index('parent_id', 'idx_parent_account_parent');
$table->index('school_year_id', 'idx_parent_account_school_year_id');
$table->unique(
['parent_id', 'school_year'],
'uniq_parent_school_year_name'
);
$table->index(
'parent_id',
'idx_parent_account_parent'
);
$table->index(
'school_year_id',
'idx_parent_account_school_year_id'
);
});
} else {
Schema::table('parent_accounts', function (Blueprint $table): void {
if (! Schema::hasColumn('parent_accounts', 'school_year_id')) {
$table->unsignedBigInteger('school_year_id')->nullable()->after('school_year');
$table->unsignedBigInteger('school_year_id')
->nullable();
}
});
}
@@ -97,31 +125,60 @@ return new class extends Migration
$table->text('reversal_reason')->nullable();
$table->unsignedBigInteger('created_by')->nullable();
$table->timestamps();
$table->unique(['parent_id', 'from_school_year', 'to_school_year'], 'uniq_parent_year_transfer_name');
$table->index('parent_id', 'idx_balance_transfer_parent');
$table->index('from_school_year_id', 'idx_balance_transfer_from_year_id');
$table->index('to_school_year_id', 'idx_balance_transfer_to_year_id');
$table->unique(
['parent_id', 'from_school_year', 'to_school_year'],
'uniq_parent_year_transfer_name'
);
$table->index(
'parent_id',
'idx_balance_transfer_parent'
);
$table->index(
'from_school_year_id',
'idx_balance_transfer_from_year_id'
);
$table->index(
'to_school_year_id',
'idx_balance_transfer_to_year_id'
);
});
} else {
Schema::table('parent_balance_transfers', function (Blueprint $table): void {
if (! Schema::hasColumn('parent_balance_transfers', 'from_school_year_id')) {
$table->unsignedBigInteger('from_school_year_id')->nullable()->after('to_school_year');
$table->unsignedBigInteger('from_school_year_id')
->nullable();
}
if (! Schema::hasColumn('parent_balance_transfers', 'to_school_year_id')) {
$table->unsignedBigInteger('to_school_year_id')->nullable()->after('from_school_year_id');
$table->unsignedBigInteger('to_school_year_id')
->nullable()
->after('from_school_year_id');
}
if (! Schema::hasColumn('parent_balance_transfers', 'source_summary')) {
$table->json('source_summary')->nullable()->after('source_summary_json');
$table->json('source_summary')
->nullable()
->after('source_summary_json');
}
if (! Schema::hasColumn('parent_balance_transfers', 'old_balance_invoice_id')) {
$table->unsignedBigInteger('old_balance_invoice_id')->nullable()->after('new_invoice_id');
$table->unsignedBigInteger('old_balance_invoice_id')
->nullable()
->after('new_invoice_id');
}
if (! Schema::hasColumn('parent_balance_transfers', 'reversed_at')) {
$table->timestamp('reversed_at')->nullable();
}
if (! Schema::hasColumn('parent_balance_transfers', 'reversed_by')) {
$table->unsignedBigInteger('reversed_by')->nullable();
}
if (! Schema::hasColumn('parent_balance_transfers', 'reversal_reason')) {
$table->text('reversal_reason')->nullable();
}
@@ -131,23 +188,36 @@ return new class extends Migration
if (Schema::hasTable('invoices')) {
Schema::table('invoices', function (Blueprint $table): void {
if (! Schema::hasColumn('invoices', 'school_year_id')) {
$table->unsignedBigInteger('school_year_id')->nullable()->after('school_year');
$table->unsignedBigInteger('school_year_id')
->nullable();
}
if (! Schema::hasColumn('invoices', 'parent_id')) {
$table->unsignedBigInteger('parent_id')->nullable();
}
if (! Schema::hasColumn('invoices', 'student_id')) {
$table->unsignedBigInteger('student_id')->nullable()->after('parent_id');
$table->unsignedBigInteger('student_id')
->nullable()
->after('parent_id');
}
if (! Schema::hasColumn('invoices', 'invoice_type')) {
$table->string('invoice_type', 50)->nullable()->after('invoice_number');
$table->string('invoice_type', 50)
->nullable()
->after('invoice_number');
}
if (! Schema::hasColumn('invoices', 'balance_transfer_id')) {
$table->unsignedBigInteger('balance_transfer_id')->nullable()->after('invoice_type');
$table->unsignedBigInteger('balance_transfer_id')
->nullable()
->after('invoice_type');
}
if (! Schema::hasColumn('invoices', 'locked_at')) {
$table->timestamp('locked_at')->nullable();
}
if (! Schema::hasColumn('invoices', 'locked_by')) {
$table->unsignedBigInteger('locked_by')->nullable();
}
@@ -159,4 +229,4 @@ return new class extends Migration
{
Schema::dropIfExists('student_enrollments');
}
};
};
@@ -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
{
public function up(): void
{
if (
Schema::hasTable('login_activity')
&& ! Schema::hasColumn('login_activity', 'school_year')
) {
Schema::table('login_activity', function (Blueprint $table): void {
$table->string('school_year', 50)->nullable();
});
}
}
public function down(): void
{
if (
Schema::hasTable('login_activity')
&& Schema::hasColumn('login_activity', 'school_year')
) {
Schema::table('login_activity', function (Blueprint $table): void {
$table->dropColumn('school_year');
});
}
}
};