<?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 Version20230711125223 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 quote_quote (id UUID NOT NULL, topic_id UUID DEFAULT NULL, name TEXT NOT NULL, author VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_668E46951F55203D ON quote_quote (topic_id)');
$this->addSql('COMMENT ON COLUMN quote_quote.id IS \'(DC2Type:quote_quote_id)\'');
$this->addSql('COMMENT ON COLUMN quote_quote.topic_id IS \'(DC2Type:quote_topic_id)\'');
$this->addSql('CREATE TABLE quote_topic (id UUID NOT NULL, name VARCHAR(255) NOT NULL, sort INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('COMMENT ON COLUMN quote_topic.id IS \'(DC2Type:quote_topic_id)\'');
$this->addSql('CREATE TABLE user_users (id UUID NOT NULL, topic_id UUID DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, surname VARCHAR(255) DEFAULT NULL, gender VARCHAR(16) DEFAULT NULL, email VARCHAR(255) NOT NULL, password_hash VARCHAR(255) DEFAULT NULL, date TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, role VARCHAR(16) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_F6415EB11F55203D ON user_users (topic_id)');
$this->addSql('COMMENT ON COLUMN user_users.id IS \'(DC2Type:user_user_id)\'');
$this->addSql('COMMENT ON COLUMN user_users.topic_id IS \'(DC2Type:quote_topic_id)\'');
$this->addSql('COMMENT ON COLUMN user_users.date IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN user_users.role IS \'(DC2Type:user_user_role)\'');
$this->addSql('ALTER TABLE quote_quote ADD CONSTRAINT FK_668E46951F55203D FOREIGN KEY (topic_id) REFERENCES quote_topic (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE user_users ADD CONSTRAINT FK_F6415EB11F55203D FOREIGN KEY (topic_id) REFERENCES quote_topic (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE quote_quote DROP CONSTRAINT FK_668E46951F55203D');
$this->addSql('ALTER TABLE user_users DROP CONSTRAINT FK_F6415EB11F55203D');
$this->addSql('DROP TABLE quote_quote');
$this->addSql('DROP TABLE quote_topic');
$this->addSql('DROP TABLE user_users');
}
}