migrations/Version20260203180050.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 Version20260203180050 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 debt (id INT AUTO_INCREMENT NOT NULL, creditor VARCHAR(255) NOT NULL, total_amount NUMERIC(19, 4) NOT NULL, installment_count INT DEFAULT NULL, paid_installment_count INT DEFAULT 0 NOT NULL, description LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE debt_payment (id INT AUTO_INCREMENT NOT NULL, debt_id INT NOT NULL, payment_date DATE NOT NULL, amount NUMERIC(19, 4) NOT NULL, is_paid TINYINT(1) DEFAULT 0 NOT NULL, paid_at DATETIME DEFAULT NULL, INDEX IDX_751D57EF240326A5 (debt_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('ALTER TABLE debt_payment ADD CONSTRAINT FK_751D57EF240326A5 FOREIGN KEY (debt_id) REFERENCES debt (id)');
  21.         $this->addSql('ALTER TABLE expense_transaction ADD description1 LONGTEXT DEFAULT NULL');
  22.     }
  23.     public function down(Schema $schema): void
  24.     {
  25.         // this down() migration is auto-generated, please modify it to your needs
  26.         $this->addSql('ALTER TABLE debt_payment DROP FOREIGN KEY FK_751D57EF240326A5');
  27.         $this->addSql('DROP TABLE debt');
  28.         $this->addSql('DROP TABLE debt_payment');
  29.         $this->addSql('ALTER TABLE expense_transaction DROP description1');
  30.     }
  31. }