<?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 `parents` (
`id` int NOT NULL,
  `secondparent_firstname` varchar(100) COLLATE utf8mb4_general_ci NOT NULL,
  `secondparent_lastname` varchar(100) COLLATE utf8mb4_general_ci NOT NULL,
  `secondparent_gender` enum('Male','Female') COLLATE utf8mb4_general_ci DEFAULT NULL,
  `secondparent_email` varchar(150) COLLATE utf8mb4_general_ci NOT NULL,
  `secondparent_phone` varchar(15) COLLATE utf8mb4_general_ci NOT NULL,
  `firstparent_id` int NOT NULL,
  `secondparent_id` int NOT NULL,
  `semester` varchar(10) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `school_year` varchar(20) COLLATE utf8mb4_general_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
SQL
        );

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

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

    }

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