<?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 `student_class` (
`id` int UNSIGNED NOT NULL,
  `student_id` int NOT NULL,
  `class_section_id` int DEFAULT NULL,
  `is_event_only` tinyint UNSIGNED NOT NULL DEFAULT '0',
  `semester` varchar(255) NOT NULL,
  `school_year` varchar(25) DEFAULT NULL,
  `description` text,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` int DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;

-- --------------------------------------------------------

--
-- Table structure for table `student_medical_conditions`
--


CREATE TABLE `student_medical_conditions` (

`id` int NOT NULL,

  `student_id` int UNSIGNED NOT NULL,

  `condition_name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
SQL
        );

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

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

    }

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