migrations/Version20250319112410.php line 1

Open in your IDE?
  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 Version20250319112410 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 orders__elements_payments (id INT AUTO_INCREMENT NOT NULL, payment_order_id INT DEFAULT NULL, order_element_id INT DEFAULT NULL, created_at DATETIME NOT NULL, price INT NOT NULL, reward_margin INT DEFAULT 0 NOT NULL, INDEX IDX_DC97B79BCD592F50 (payment_order_id), INDEX IDX_DC97B79BACC5D771 (order_element_id), INDEX created_at (created_at), UNIQUE INDEX unique_payment_element_id (payment_order_id, order_element_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('ALTER TABLE orders__elements_payments ADD CONSTRAINT FK_DC97B79BCD592F50 FOREIGN KEY (payment_order_id) REFERENCES orders__payments (id)');
  20.         $this->addSql('ALTER TABLE orders__elements_payments ADD CONSTRAINT FK_DC97B79BACC5D771 FOREIGN KEY (order_element_id) REFERENCES orders__elements (id)');
  21.         $this->addSql('ALTER TABLE orders__elements ADD searcher_user_id INT DEFAULT NULL');
  22.         $this->addSql('ALTER TABLE orders__elements ADD CONSTRAINT FK_184A03654A921025 FOREIGN KEY (searcher_user_id) REFERENCES users__users (id) ON DELETE SET NULL');
  23.         $this->addSql('CREATE INDEX IDX_184A03654A921025 ON orders__elements (searcher_user_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 orders__elements_payments DROP FOREIGN KEY FK_DC97B79BCD592F50');
  29.         $this->addSql('ALTER TABLE orders__elements_payments DROP FOREIGN KEY FK_DC97B79BACC5D771');
  30.         $this->addSql('DROP TABLE orders__elements_payments');
  31.         $this->addSql('ALTER TABLE orders__elements DROP FOREIGN KEY FK_184A03654A921025');
  32.         $this->addSql('DROP INDEX IDX_184A03654A921025 ON orders__elements');
  33.         $this->addSql('ALTER TABLE orders__elements DROP searcher_user_id');
  34.     }
  35. }