migrations/Version20251009215449.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 Version20251009215449 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(<<<'SQL'
  19.             CREATE TABLE payment (id INT AUTO_INCREMENT NOT NULL, order_id INT NOT NULL, konnect_payment_id VARCHAR(255) NOT NULL, status VARCHAR(20) NOT NULL, amount NUMERIC(10, 2) DEFAULT NULL, currency VARCHAR(3) DEFAULT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_6D28840DEEEA3962 (konnect_payment_id), INDEX IDX_6D28840D8D9F6D38 (order_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
  20.         SQL);
  21.         $this->addSql(<<<'SQL'
  22.             ALTER TABLE payment ADD CONSTRAINT FK_6D28840D8D9F6D38 FOREIGN KEY (order_id) REFERENCES `order` (id)
  23.         SQL);
  24.         $this->addSql(<<<'SQL'
  25.             ALTER TABLE `order` CHANGE payment_id order_reference VARCHAR(255) DEFAULT NULL
  26.         SQL);
  27.         $this->addSql(<<<'SQL'
  28.             ALTER TABLE user CHANGE roles roles JSON NOT NULL COMMENT '(DC2Type:json)'
  29.         SQL);
  30.     }
  31.     public function down(Schema $schema): void
  32.     {
  33.         // this down() migration is auto-generated, please modify it to your needs
  34.         $this->addSql(<<<'SQL'
  35.             ALTER TABLE payment DROP FOREIGN KEY FK_6D28840D8D9F6D38
  36.         SQL);
  37.         $this->addSql(<<<'SQL'
  38.             DROP TABLE payment
  39.         SQL);
  40.         $this->addSql(<<<'SQL'
  41.             ALTER TABLE `order` CHANGE order_reference payment_id VARCHAR(255) DEFAULT NULL
  42.         SQL);
  43.         $this->addSql(<<<'SQL'
  44.             ALTER TABLE user CHANGE roles roles JSON NOT NULL COMMENT '(DC2Type:json)'
  45.         SQL);
  46.     }
  47. }