<?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 Version20241204160251 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 mydevel_webroot_file (
          id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
          owner_id INTEGER NOT NULL,
          url CLOB NOT NULL,
          abspath CLOB NOT NULL,
          description CLOB DEFAULT NULL,
          CONSTRAINT FK_A7B135127E3C61F9 FOREIGN KEY (owner_id) REFERENCES mydevel_webroot_user (id) NOT DEFERRABLE INITIALLY IMMEDIATE
        )');
        $this->addSql('CREATE UNIQUE INDEX UNIQ_A7B135127E3C61F9 ON mydevel_webroot_file (owner_id)');
        $this->addSql('CREATE TABLE mydevel_webroot_file_permission (
          id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
          role_id INTEGER NOT NULL,
          webroot_file_id INTEGER NOT NULL,
          is_readable BOOLEAN DEFAULT 1 NOT NULL,
          is_writeable BOOLEAN DEFAULT 0 NOT NULL,
          is_deleteable BOOLEAN DEFAULT 0 NOT NULL,
          CONSTRAINT FK_4D56CEFD60322AC FOREIGN KEY (role_id) REFERENCES mydevel_webroot_role (id) NOT DEFERRABLE INITIALLY IMMEDIATE,
          CONSTRAINT FK_4D56CEF2800AFC9 FOREIGN KEY (webroot_file_id) REFERENCES mydevel_webroot_file (id) NOT DEFERRABLE INITIALLY IMMEDIATE
        )');
        $this->addSql('CREATE UNIQUE INDEX UNIQ_4D56CEFD60322AC ON mydevel_webroot_file_permission (role_id)');
        $this->addSql('CREATE INDEX IDX_4D56CEF2800AFC9 ON mydevel_webroot_file_permission (webroot_file_id)');
        $this->addSql('CREATE TABLE mydevel_webroot_role (
          id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
          role VARCHAR(255) NOT NULL,
          name VARCHAR(255) NOT NULL,
          description VARCHAR(1023) DEFAULT NULL
        )');
        $this->addSql('CREATE TABLE mydevel_webroot_user (
          id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
          username VARCHAR(180) NOT NULL,
          roles CLOB NOT NULL --(DC2Type:json)
          ,
          password VARCHAR(255) NOT NULL,
          email VARCHAR(255) NOT NULL,
          is_admin BOOLEAN DEFAULT 0 NOT NULL
        )');
        $this->addSql('CREATE UNIQUE INDEX UNIQ_A6BDD54BE7927C74 ON mydevel_webroot_user (email)');
        $this->addSql('CREATE UNIQUE INDEX UNIQ_IDENTIFIER_USERNAME ON mydevel_webroot_user (username)');
        $this->addSql('CREATE TABLE reset_password_request (
          id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
          user_id INTEGER NOT NULL,
          selector VARCHAR(20) NOT NULL,
          hashed_token VARCHAR(100) NOT NULL,
          requested_at DATETIME NOT NULL --(DC2Type:datetime_immutable)
          ,
          expires_at DATETIME NOT NULL --(DC2Type:datetime_immutable)
          ,
          CONSTRAINT FK_7CE748AA76ED395 FOREIGN KEY (user_id) REFERENCES mydevel_webroot_user (id) NOT DEFERRABLE INITIALLY IMMEDIATE
        )');
        $this->addSql('CREATE INDEX IDX_7CE748AA76ED395 ON reset_password_request (user_id)');
        $this->addSql('CREATE TABLE messenger_messages (
          id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
          body CLOB NOT NULL,
          headers CLOB NOT NULL,
          queue_name VARCHAR(190) NOT NULL,
          created_at DATETIME NOT NULL --(DC2Type:datetime_immutable)
          ,
          available_at DATETIME NOT NULL --(DC2Type:datetime_immutable)
          ,
          delivered_at DATETIME DEFAULT NULL --(DC2Type:datetime_immutable)
        )');
        $this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name)');
        $this->addSql('CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at)');
        $this->addSql('CREATE INDEX IDX_75EA56E016BA31DB ON messenger_messages (delivered_at)');
        $this->addSql('CREATE TABLE rememberme_token (
          series VARCHAR(88) NOT NULL,
          value VARCHAR(88) NOT NULL,
          lastUsed DATETIME NOT NULL --(DC2Type:datetime_immutable)
          ,
          class VARCHAR(100) NOT NULL,
          username VARCHAR(200) NOT NULL,
          PRIMARY KEY(series)
        )');
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->addSql('DROP TABLE mydevel_webroot_file');
        $this->addSql('DROP TABLE mydevel_webroot_file_permission');
        $this->addSql('DROP TABLE mydevel_webroot_role');
        $this->addSql('DROP TABLE mydevel_webroot_user');
        $this->addSql('DROP TABLE reset_password_request');
        $this->addSql('DROP TABLE messenger_messages');
        $this->addSql('DROP TABLE rememberme_token');
    }
}
