<?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 Version20230209164715 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 user_agenda (id INT AUTO_INCREMENT NOT NULL, `user_id` VARCHAR(255) NOT NULL, `date` DATETIME NOT NULL, `creation_user` VARCHAR(50) NOT NULL, `creation_date` DATETIME NOT NULL, `modified_user` VARCHAR(50) DEFAULT NULL, `modified_date` DATETIME DEFAULT NULL, type VARCHAR(3) NOT NULL, INDEX idx_user_id_date (user_id, date), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user_agenda_activity (id INT NOT NULL, `category` VARCHAR(255) NOT NULL COMMENT \'(DC2Type:user_agenda_activity_category)\', `name` VARCHAR(100) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user_agenda_note (id INT NOT NULL, `category` VARCHAR(255) NOT NULL COMMENT \'(DC2Type:user_agenda_note_category)\', `note` VARCHAR(4000) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user_agenda_occurence (id INT NOT NULL, `category` VARCHAR(255) NOT NULL COMMENT \'(DC2Type:user_agenda_occurrence_category)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user_diary (id INT AUTO_INCREMENT NOT NULL, `user_id` VARCHAR(255) NOT NULL, `creation_user` VARCHAR(50) NOT NULL, `creation_date` DATETIME NOT NULL, `modified_user` VARCHAR(50) DEFAULT NULL, `modified_date` DATETIME DEFAULT NULL, type VARCHAR(3) NOT NULL, INDEX idx_user_id (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user_diary_document (id INT NOT NULL, `document_id` INT NOT NULL, INDEX IDX_A96CC8A55D9C4E11 (`document_id`), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user_diary_note (id INT NOT NULL, `category` VARCHAR(255) NOT NULL COMMENT \'(DC2Type:user_diary_note_category)\', `note` VARCHAR(4000) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user_diary_phrase (id INT NOT NULL, `category` VARCHAR(255) NOT NULL COMMENT \'(DC2Type:user_diary_phrase_category)\', `phrase` VARCHAR(4000) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user_diary_word (id INT NOT NULL, `word` VARCHAR(100) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE user_agenda_activity ADD CONSTRAINT FK_BFF0D0B1BF396750 FOREIGN KEY (id) REFERENCES user_agenda (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE user_agenda_note ADD CONSTRAINT FK_5B8391F1BF396750 FOREIGN KEY (id) REFERENCES user_agenda (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE user_agenda_occurence ADD CONSTRAINT FK_536677A7BF396750 FOREIGN KEY (id) REFERENCES user_agenda (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE user_diary_document ADD CONSTRAINT FK_A96CC8A55D9C4E11 FOREIGN KEY (`document_id`) REFERENCES document (`id`) ON DELETE CASCADE');
$this->addSql('ALTER TABLE user_diary_document ADD CONSTRAINT FK_A96CC8A5BF396750 FOREIGN KEY (id) REFERENCES user_diary (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE user_diary_note ADD CONSTRAINT FK_73007D53BF396750 FOREIGN KEY (id) REFERENCES user_diary (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE user_diary_phrase ADD CONSTRAINT FK_6EAF95F0BF396750 FOREIGN KEY (id) REFERENCES user_diary (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE user_diary_word ADD CONSTRAINT FK_7F4CF256BF396750 FOREIGN KEY (id) REFERENCES user_diary (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE user_agenda_activity DROP FOREIGN KEY FK_BFF0D0B1BF396750');
$this->addSql('ALTER TABLE user_agenda_note DROP FOREIGN KEY FK_5B8391F1BF396750');
$this->addSql('ALTER TABLE user_agenda_occurence DROP FOREIGN KEY FK_536677A7BF396750');
$this->addSql('ALTER TABLE user_diary_document DROP FOREIGN KEY FK_A96CC8A5BF396750');
$this->addSql('ALTER TABLE user_diary_note DROP FOREIGN KEY FK_73007D53BF396750');
$this->addSql('ALTER TABLE user_diary_phrase DROP FOREIGN KEY FK_6EAF95F0BF396750');
$this->addSql('ALTER TABLE user_diary_word DROP FOREIGN KEY FK_7F4CF256BF396750');
$this->addSql('DROP TABLE user_agenda');
$this->addSql('DROP TABLE user_agenda_activity');
$this->addSql('DROP TABLE user_agenda_note');
$this->addSql('DROP TABLE user_agenda_occurence');
$this->addSql('DROP TABLE user_diary');
$this->addSql('DROP TABLE user_diary_document');
$this->addSql('DROP TABLE user_diary_note');
$this->addSql('DROP TABLE user_diary_phrase');
$this->addSql('DROP TABLE user_diary_word');
}
}