migrations/Version20230426195047.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 Version20230426195047 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 market_payout (id INT AUTO_INCREMENT NOT NULL, market_item_id INT DEFAULT NULL, market_offer_id INT DEFAULT NULL, wallet_id INT NOT NULL, payout DOUBLE PRECISION NOT NULL, fee DOUBLE PRECISION NOT NULL, UNIQUE INDEX UNIQ_6E8A020E1BF9BADE (market_item_id), UNIQUE INDEX UNIQ_6E8A020EBE776126 (market_offer_id), INDEX IDX_6E8A020E712520F3 (wallet_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE withdrawal_log (id INT AUTO_INCREMENT NOT NULL, wallet_id INT NOT NULL, amount DOUBLE PRECISION NOT NULL, withdrawn_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', tx VARCHAR(255) NOT NULL, INDEX IDX_5589944B712520F3 (wallet_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('ALTER TABLE market_payout ADD CONSTRAINT FK_6E8A020E1BF9BADE FOREIGN KEY (market_item_id) REFERENCES market_item (id)');
  21.         $this->addSql('ALTER TABLE market_payout ADD CONSTRAINT FK_6E8A020EBE776126 FOREIGN KEY (market_offer_id) REFERENCES market_offer (id)');
  22.         $this->addSql('ALTER TABLE market_payout ADD CONSTRAINT FK_6E8A020E712520F3 FOREIGN KEY (wallet_id) REFERENCES theta_wallet (id)');
  23.         $this->addSql('ALTER TABLE withdrawal_log ADD CONSTRAINT FK_5589944B712520F3 FOREIGN KEY (wallet_id) REFERENCES theta_wallet (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 market_payout DROP FOREIGN KEY FK_6E8A020E1BF9BADE');
  29.         $this->addSql('ALTER TABLE market_payout DROP FOREIGN KEY FK_6E8A020EBE776126');
  30.         $this->addSql('ALTER TABLE market_payout DROP FOREIGN KEY FK_6E8A020E712520F3');
  31.         $this->addSql('ALTER TABLE withdrawal_log DROP FOREIGN KEY FK_5589944B712520F3');
  32.         $this->addSql('DROP TABLE market_payout');
  33.         $this->addSql('DROP TABLE withdrawal_log');
  34.     }
  35. }