migrations/Version20230515184225.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 Version20230515184225 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 crate_action_log (id INT AUTO_INCREMENT NOT NULL, received_by_id INT DEFAULT NULL, opened_by_id INT DEFAULT NULL, received_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', received_tx VARCHAR(255) DEFAULT NULL, initiate_open_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', is_opened TINYINT(1) DEFAULT NULL, opened_tx VARCHAR(255) DEFAULT NULL, INDEX IDX_338FCD596F8DDD17 (received_by_id), INDEX IDX_338FCD59AB159F5 (opened_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('ALTER TABLE crate_action_log ADD CONSTRAINT FK_338FCD596F8DDD17 FOREIGN KEY (received_by_id) REFERENCES theta_wallet (id)');
  20.         $this->addSql('ALTER TABLE crate_action_log ADD CONSTRAINT FK_338FCD59AB159F5 FOREIGN KEY (opened_by_id) REFERENCES theta_wallet (id)');
  21.         $this->addSql('ALTER TABLE nft_hub ADD crate_action_log_id INT DEFAULT NULL');
  22.         $this->addSql('ALTER TABLE nft_hub ADD CONSTRAINT FK_B0444A2567FE78E FOREIGN KEY (crate_action_log_id) REFERENCES crate_action_log (id)');
  23.         $this->addSql('CREATE UNIQUE INDEX UNIQ_B0444A2567FE78E ON nft_hub (crate_action_log_id)');
  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 nft_hub DROP FOREIGN KEY FK_B0444A2567FE78E');
  29.         $this->addSql('ALTER TABLE crate_action_log DROP FOREIGN KEY FK_338FCD596F8DDD17');
  30.         $this->addSql('ALTER TABLE crate_action_log DROP FOREIGN KEY FK_338FCD59AB159F5');
  31.         $this->addSql('DROP TABLE crate_action_log');
  32.         $this->addSql('DROP INDEX UNIQ_B0444A2567FE78E ON nft_hub');
  33.         $this->addSql('ALTER TABLE nft_hub DROP crate_action_log_id');
  34.     }
  35. }