<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
 * Auto-generated Migration: Please modify to your needs!
 */
final class Version20260609134741 extends AbstractMigration
{
    public function getDescription(): string
    {
        return '';
    }

    public function up(Schema $schema): void
    {
        // this up() migration is auto-generated, please modify it to your needs
        $this->addSql('CREATE TABLE appointments (version INT DEFAULT 1 NOT NULL, id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, slot_start INT NOT NULL, slot_end INT NOT NULL, status VARCHAR(30) NOT NULL, note VARCHAR(255) DEFAULT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, doctor_id INT NOT NULL, user_id INT NOT NULL, UNIQUE INDEX UNIQ_6A41727AD17F50A6 (uuid), INDEX IDX_6A41727A87F4FB17 (doctor_id), INDEX IDX_6A41727AA76ED395 (user_id), INDEX idx_appointments_doctor_slot (doctor_id, slot_start), INDEX idx_appointments_user_status (user_id, status), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
        $this->addSql('ALTER TABLE appointments ADD CONSTRAINT FK_6A41727A87F4FB17 FOREIGN KEY (doctor_id) REFERENCES doctors (id) ON DELETE RESTRICT');
        $this->addSql('ALTER TABLE appointments ADD CONSTRAINT FK_6A41727AA76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE RESTRICT');
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->addSql('ALTER TABLE appointments DROP FOREIGN KEY FK_6A41727A87F4FB17');
        $this->addSql('ALTER TABLE appointments DROP FOREIGN KEY FK_6A41727AA76ED395');
        $this->addSql('DROP TABLE appointments');
    }
}
