migrations/Version20220630082158.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 Version20220630082158 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('ALTER TABLE ledger__account DROP CONSTRAINT fk_586eb223217bbb47');
  19.         $this->addSql('DROP INDEX uniq_586eb223217bbb47');
  20.         $this->addSql('ALTER TABLE ledger__account RENAME COLUMN person_id TO owner_id');
  21.         $this->addSql('ALTER TABLE ledger__account ADD CONSTRAINT FK_586EB2237E3C61F9 FOREIGN KEY (owner_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  22.         $this->addSql('CREATE UNIQUE INDEX UNIQ_586EB2237E3C61F9 ON ledger__account (owner_id)');
  23.         $this->addSql('ALTER TABLE shop__order DROP CONSTRAINT fk_fab35986217bbb47');
  24.         $this->addSql('DROP INDEX idx_fab35986217bbb47');
  25.         $this->addSql('ALTER TABLE shop__order RENAME COLUMN person_id TO buyer_id');
  26.         $this->addSql('ALTER TABLE shop__order ADD CONSTRAINT FK_FAB359866C755722 FOREIGN KEY (buyer_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  27.         $this->addSql('CREATE INDEX IDX_FAB359866C755722 ON shop__order (buyer_id)');
  28.         $this->addSql('ALTER TABLE ledger__transaction ALTER comment DROP NOT NULL');
  29.     }
  30.     public function down(Schema $schema): void
  31.     {
  32.         // this down() migration is auto-generated, please modify it to your needs
  33.         $this->addSql('ALTER TABLE ledger__account DROP CONSTRAINT FK_586EB2237E3C61F9');
  34.         $this->addSql('DROP INDEX UNIQ_586EB2237E3C61F9');
  35.         $this->addSql('ALTER TABLE ledger__account RENAME COLUMN owner_id TO person_id');
  36.         $this->addSql('ALTER TABLE ledger__account ADD CONSTRAINT fk_586eb223217bbb47 FOREIGN KEY (person_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  37.         $this->addSql('CREATE UNIQUE INDEX uniq_586eb223217bbb47 ON ledger__account (person_id)');
  38.         $this->addSql('ALTER TABLE shop__order DROP CONSTRAINT FK_FAB359866C755722');
  39.         $this->addSql('DROP INDEX IDX_FAB359866C755722');
  40.         $this->addSql('ALTER TABLE shop__order RENAME COLUMN buyer_id TO person_id');
  41.         $this->addSql('ALTER TABLE shop__order ADD CONSTRAINT fk_fab35986217bbb47 FOREIGN KEY (person_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  42.         $this->addSql('CREATE INDEX idx_fab35986217bbb47 ON shop__order (person_id)');
  43.         $this->addSql('ALTER TABLE ledger__transaction ALTER comment SET NOT NULL');
  44.     }
  45. }