<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250319112410 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$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');
$this->addSql('ALTER TABLE orders__elements_payments ADD CONSTRAINT FK_DC97B79BCD592F50 FOREIGN KEY (payment_order_id) REFERENCES orders__payments (id)');
$this->addSql('ALTER TABLE orders__elements_payments ADD CONSTRAINT FK_DC97B79BACC5D771 FOREIGN KEY (order_element_id) REFERENCES orders__elements (id)');
$this->addSql('ALTER TABLE orders__elements ADD searcher_user_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE orders__elements ADD CONSTRAINT FK_184A03654A921025 FOREIGN KEY (searcher_user_id) REFERENCES users__users (id) ON DELETE SET NULL');
$this->addSql('CREATE INDEX IDX_184A03654A921025 ON orders__elements (searcher_user_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE orders__elements_payments DROP FOREIGN KEY FK_DC97B79BCD592F50');
$this->addSql('ALTER TABLE orders__elements_payments DROP FOREIGN KEY FK_DC97B79BACC5D771');
$this->addSql('DROP TABLE orders__elements_payments');
$this->addSql('ALTER TABLE orders__elements DROP FOREIGN KEY FK_184A03654A921025');
$this->addSql('DROP INDEX IDX_184A03654A921025 ON orders__elements');
$this->addSql('ALTER TABLE orders__elements DROP searcher_user_id');
}
}