migrations/Version20231211221056.php line 1

  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20231211221056 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('CREATE TABLE skill_tree (id INT AUTO_INCREMENT NOT NULL, type_id INT NOT NULL, name VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, cost INT NOT NULL, icon VARCHAR(255) NOT NULL, INDEX IDX_F07FC26EC54C8C93 (type_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE skill_tree_type (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, background VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('CREATE TABLE user_ranking (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, xp BIGINT NOT NULL, rank INT NOT NULL, skill_point INT NOT NULL, UNIQUE INDEX UNIQ_D8B527DAA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  21.         $this->addSql('ALTER TABLE skill_tree ADD CONSTRAINT FK_F07FC26EC54C8C93 FOREIGN KEY (type_id) REFERENCES skill_tree_type (id)');
  22.         $this->addSql('ALTER TABLE user_ranking ADD CONSTRAINT FK_D8B527DAA76ED395 FOREIGN KEY (user_id) REFERENCES `user` (id)');
  23.         $this->addSql('ALTER TABLE user ADD avatar VARCHAR(255) DEFAULT NULL');
  24.     }
  25.     public function down(Schema $schema): void
  26.     {
  27.         // this down() migration is auto-generated, please modify it to your needs
  28.         $this->addSql('ALTER TABLE skill_tree DROP FOREIGN KEY FK_F07FC26EC54C8C93');
  29.         $this->addSql('ALTER TABLE user_ranking DROP FOREIGN KEY FK_D8B527DAA76ED395');
  30.         $this->addSql('DROP TABLE skill_tree');
  31.         $this->addSql('DROP TABLE skill_tree_type');
  32.         $this->addSql('DROP TABLE user_ranking');
  33.         $this->addSql('ALTER TABLE `user` DROP avatar');
  34.     }
  35. }