<?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 Version20260211142601 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 document (id BINARY(16) NOT NULL, title VARCHAR(255) NOT NULL, status VARCHAR(20) NOT NULL, created_at DATETIME NOT NULL, created_by_id BINARY(16) NOT NULL, current_version_id BINARY(16) DEFAULT NULL, INDEX IDX_D8698A76B03A8386 (created_by_id), INDEX IDX_D8698A769407EE77 (current_version_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
        $this->addSql('CREATE TABLE document_version (id BINARY(16) NOT NULL, version_number INT NOT NULL, file_path VARCHAR(255) NOT NULL, checksum VARCHAR(64) NOT NULL, ingest_status VARCHAR(20) NOT NULL, created_at DATETIME NOT NULL, is_active TINYINT NOT NULL, document_id BINARY(16) NOT NULL, created_by_id BINARY(16) NOT NULL, INDEX IDX_1B73751FC33F7837 (document_id), INDEX IDX_1B73751FB03A8386 (created_by_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
        $this->addSql('ALTER TABLE document ADD CONSTRAINT FK_D8698A76B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
        $this->addSql('ALTER TABLE document ADD CONSTRAINT FK_D8698A769407EE77 FOREIGN KEY (current_version_id) REFERENCES document_version (id)');
        $this->addSql('ALTER TABLE document_version ADD CONSTRAINT FK_1B73751FC33F7837 FOREIGN KEY (document_id) REFERENCES document (id)');
        $this->addSql('ALTER TABLE document_version ADD CONSTRAINT FK_1B73751FB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->addSql('ALTER TABLE document DROP FOREIGN KEY FK_D8698A76B03A8386');
        $this->addSql('ALTER TABLE document DROP FOREIGN KEY FK_D8698A769407EE77');
        $this->addSql('ALTER TABLE document_version DROP FOREIGN KEY FK_1B73751FC33F7837');
        $this->addSql('ALTER TABLE document_version DROP FOREIGN KEY FK_1B73751FB03A8386');
        $this->addSql('DROP TABLE document');
        $this->addSql('DROP TABLE document_version');
    }
}
