<?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 `users` (
`id` int UNSIGNED NOT NULL,
  `school_id` int UNSIGNED DEFAULT NULL,
  `firstname` varchar(255) NOT NULL,
  `lastname` varchar(255) NOT NULL,
  `gender` enum('Male','Female') DEFAULT NULL,
  `cellphone` varchar(25) NOT NULL,
  `email` varchar(255) NOT NULL,
  `address_street` varchar(255) NOT NULL,
  `apt` varchar(25) DEFAULT NULL,
  `city` varchar(255) NOT NULL,
  `state` varchar(25) NOT NULL,
  `zip` varchar(25) NOT NULL,
  `accept_school_policy` tinyint(1) NOT NULL,
  `is_verified` tinyint(1) NOT NULL DEFAULT '0',
  `status` varchar(10) NOT NULL DEFAULT 'Inactive',
  `is_suspended` tinyint(1) NOT NULL DEFAULT '0',
  `failed_attempts` int DEFAULT '0',
  `password` varchar(255) NOT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  `token` varchar(255) DEFAULT NULL,
  `account_id` varchar(255) DEFAULT NULL,
  `user_type` enum('primary','secondary','tertiary') DEFAULT 'primary',
  `semester` varchar(255) NOT NULL,
  `school_year` varchar(9) DEFAULT NULL,
  `rfid_tag` varchar(100) DEFAULT NULL,
  `last_failed_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
SQL
        );

    }

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