migrations/Version20260320204209.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 Version20260320204209 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 (id INT AUTO_INCREMENT NOT NULL, prestataire_id INT NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', checkout_session_id VARCHAR(255) NOT NULL, checkout_expires_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', status VARCHAR(20) DEFAULT \'pending\' NOT NULL, stripe_event_id VARCHAR(255) DEFAULT NULL, order_type VARCHAR(20) DEFAULT \'pack\' NOT NULL, credits INT DEFAULT NULL, price INT DEFAULT 0 NOT NULL, return_token_hash VARCHAR(64) DEFAULT NULL, demande_ids JSON NOT NULL, UNIQUE INDEX UNIQ_E52FFDEEDA6D31C4 (checkout_session_id), UNIQUE INDEX UNIQ_E52FFDEE2CB034B8 (stripe_event_id), INDEX IDX_E52FFDEEBE3DB2B7 (prestataire_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19. $this->addSql('ALTER TABLE orders ADD CONSTRAINT FK_E52FFDEEBE3DB2B7 FOREIGN KEY (prestataire_id) REFERENCES Prestataire (id)');
  20. $this->addSql('ALTER TABLE Payment DROP FOREIGN KEY FK_A295BD912FC0CB0F');
  21. // $this->addSql('DROP TABLE Payment');
  22. $this->addSql('ALTER TABLE Transaction ADD order_id INT DEFAULT NULL');
  23. $this->addSql('ALTER TABLE Transaction ADD CONSTRAINT FK_F4AB8A068D9F6D38 FOREIGN KEY (order_id) REFERENCES orders (id) ON DELETE SET NULL');
  24. $this->addSql('CREATE UNIQUE INDEX UNIQ_F4AB8A068D9F6D38 ON Transaction (order_id)');
  25. }
  26. public function down(Schema $schema): void
  27. {
  28. // this down() migration is auto-generated, please modify it to your needs
  29. $this->addSql('ALTER TABLE Transaction DROP FOREIGN KEY FK_F4AB8A068D9F6D38');
  30. // $this->addSql('CREATE TABLE Payment (id INT AUTO_INCREMENT NOT NULL, transaction_id INT DEFAULT NULL, resource_id INT NOT NULL, UNIQUE INDEX UNIQ_A295BD912FC0CB0F (transaction_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  31. $this->addSql('ALTER TABLE Payment ADD CONSTRAINT FK_A295BD912FC0CB0F FOREIGN KEY (transaction_id) REFERENCES Transaction (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
  32. $this->addSql('ALTER TABLE orders DROP FOREIGN KEY FK_E52FFDEEBE3DB2B7');
  33. $this->addSql('DROP TABLE orders');
  34. $this->addSql('DROP INDEX UNIQ_F4AB8A068D9F6D38 ON Transaction');
  35. $this->addSql('ALTER TABLE Transaction DROP order_id');
  36. }
  37. }