<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up(): void
    {
        App\Support\SqliteCompat::statement(<<<'SQL'
CREATE TABLE `final_exam` (
`id` int UNSIGNED NOT NULL,
  `student_id` int NOT NULL,
  `school_id` char(36) NOT NULL,
  `class_section_id` int DEFAULT NULL,
  `updated_by` int NOT NULL,
  `score` float DEFAULT NULL,
  `semester` varchar(25) NOT NULL DEFAULT 'Spring',
  `school_year` varchar(9) DEFAULT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
SQL
        );

        App\Support\SqliteCompat::statement(<<<'SQL'
ALTER TABLE `final_exam`
  ADD PRIMARY KEY (`id`);
SQL
        );

        App\Support\SqliteCompat::statement(<<<'SQL'
ALTER TABLE `final_exam`
  MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
SQL
        );

    }

    public function down(): void
    {
        Schema::dropIfExists('final_exam');
    }
};