add report card logic

This commit is contained in:
root
2026-03-10 17:33:03 -04:00
parent c235fd2170
commit a82f7aedbc
16 changed files with 2502 additions and 1998 deletions
@@ -0,0 +1,46 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
App\Support\SqliteCompat::statement(<<<'SQL'
CREATE TABLE `report_card_acknowledgements` (
`id` int UNSIGNED NOT NULL,
`parent_id` int DEFAULT NULL,
`student_id` int NOT NULL,
`school_year` varchar(20) NOT NULL,
`semester` varchar(20) NOT NULL,
`viewed_at` datetime DEFAULT NULL,
`signed_at` datetime DEFAULT NULL,
`signed_name` varchar(255) DEFAULT NULL,
`signer_ip` varchar(45) DEFAULT NULL,
`created_at` datetime DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
SQL
);
App\Support\SqliteCompat::statement(<<<'SQL'
ALTER TABLE `report_card_acknowledgements`
ADD PRIMARY KEY (`id`),
ADD KEY `idx_report_card_ack_student` (`student_id`),
ADD KEY `idx_report_card_ack_school_term` (`school_year`, `semester`);
SQL
);
App\Support\SqliteCompat::statement(<<<'SQL'
ALTER TABLE `report_card_acknowledgements`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
SQL
);
}
public function down(): void
{
Schema::dropIfExists('report_card_acknowledgements');
}
};