migrations/Version20220218141930.php line 1

  1. <?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 Version20220218141930 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 unplayable_entity (id INT AUTO_INCREMENT NOT NULL, place_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, hp INT NOT NULL, hp_max INT NOT NULL, ap INT NOT NULL, ap_max INT NOT NULL, armor_class INT NOT NULL, INDEX IDX_86A7E937DA6A219 (place_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
            $this->addSql('ALTER TABLE unplayable_entity ADD CONSTRAINT FK_86A7E937DA6A219 FOREIGN KEY (place_id) REFERENCES place (id)');
            $this->addSql('ALTER TABLE message ADD playable_entity_origin_id INT DEFAULT NULL');
            $this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307FD1741030 FOREIGN KEY (playable_entity_origin_id) REFERENCES playable_entity (id)');
            $this->addSql('CREATE INDEX IDX_B6BD307FD1741030 ON message (playable_entity_origin_id)');
            $this->addSql('ALTER TABLE playable_entity ADD place_id INT DEFAULT NULL');
            $this->addSql('ALTER TABLE playable_entity ADD CONSTRAINT FK_114242BEDA6A219 FOREIGN KEY (place_id) REFERENCES place (id)');
            $this->addSql('CREATE INDEX IDX_114242BEDA6A219 ON playable_entity (place_id)');
        }
    
        public function down(Schema $schema): void
        {
            // this down() migration is auto-generated, please modify it to your needs
            $this->addSql('DROP TABLE unplayable_entity');
            $this->addSql('ALTER TABLE message DROP FOREIGN KEY FK_B6BD307FD1741030');
            $this->addSql('DROP INDEX IDX_B6BD307FD1741030 ON message');
            $this->addSql('ALTER TABLE message DROP playable_entity_origin_id, CHANGE content content LONGTEXT NOT NULL COLLATE `utf8mb4_unicode_ci`');
            $this->addSql('ALTER TABLE path CHANGE name name VARCHAR(255) NOT NULL COLLATE `utf8mb4_unicode_ci`');
            $this->addSql('ALTER TABLE place CHANGE name name VARCHAR(255) NOT NULL COLLATE `utf8mb4_unicode_ci`');
            $this->addSql('ALTER TABLE playable_entity DROP FOREIGN KEY FK_114242BEDA6A219');
            $this->addSql('DROP INDEX IDX_114242BEDA6A219 ON playable_entity');
            $this->addSql('ALTER TABLE playable_entity DROP place_id, CHANGE name name VARCHAR(255) NOT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE trombinoscope trombinoscope LONGTEXT DEFAULT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:array)\', CHANGE skills skills LONGTEXT DEFAULT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:array)\', CHANGE abilities abilities LONGTEXT DEFAULT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:array)\'');
            $this->addSql('ALTER TABLE user CHANGE email email VARCHAR(180) NOT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE password password VARCHAR(255) NOT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE nickname nickname VARCHAR(255) NOT NULL COLLATE `utf8mb4_unicode_ci`');
        }
    }