migrations/Version20220915114722.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 Version20220915114722 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 rank_history (id UUID NOT NULL, owner_id UUID NOT NULL, rank INT NOT NULL, total INT NOT NULL, week INT NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
  19.         $this->addSql('CREATE INDEX IDX_536F5197E3C61F9 ON rank_history (owner_id)');
  20.         $this->addSql('COMMENT ON COLUMN rank_history.id IS \'(DC2Type:uuid)\'');
  21.         $this->addSql('COMMENT ON COLUMN rank_history.owner_id IS \'(DC2Type:uuid)\'');
  22.         $this->addSql('ALTER TABLE rank_history ADD CONSTRAINT FK_536F5197E3C61F9 FOREIGN KEY (owner_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  23.         $this->addSql('ALTER TABLE "user" ADD hidden BOOLEAN DEFAULT true NOT 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('DROP TABLE rank_history');
  29.         $this->addSql('ALTER TABLE "user" DROP hidden');
  30.     }
  31. }