add report card logic
This commit is contained in:
@@ -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');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user