migrations/2020/11/Version20201116031043.php line 1
<?phpdeclare(strict_types=1);namespace DoctrineMigrations;use Doctrine\DBAL\Schema\Schema;use Doctrine\Migrations\AbstractMigration;final class Version20201116031043 extends AbstractMigration{public function up(Schema $schema): void{$this->addSql('CREATE TABLE invoice_repeat_rule_item (id BINARY(16) NOT NULL COMMENT \'(DC2Type:invoice_repeat_rule_item_id)\', repeat_rule_id BINARY(16) NOT NULL COMMENT \'(DC2Type:invoice_repeat_rule_id)\', sequence SMALLINT NOT NULL, description VARCHAR(255) NOT NULL, quantity INT NOT NULL, unit_price INT NOT NULL, vat INT NOT NULL, INDEX IDX_2B9B97D93AE11C3E (repeat_rule_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');$this->addSql('ALTER TABLE invoice_repeat_rule_item ADD CONSTRAINT FK_2B9B97D93AE11C3E FOREIGN KEY (repeat_rule_id) REFERENCES invoice_repeat_rule (id)');$this->addSql('ALTER TABLE invoice_draft ADD repeat_invoice TINYINT(1) DEFAULT NULL, ADD due_date_days SMALLINT DEFAULT NULL, ADD active_from DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', ADD active_to DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', ADD interlude SMALLINT DEFAULT NULL COMMENT \'(DC2Type:invoice_repeat_interval)\', ADD add_interval_dates TINYINT(1) DEFAULT NULL');$this->addSql('ALTER TABLE invoice_draft_item CHANGE quantity quantity INT DEFAULT NULL, CHANGE unit_price unit_price INT DEFAULT NULL, CHANGE vat vat INT DEFAULT NULL');$this->addSql('ALTER TABLE invoice_repeat_rule DROP FOREIGN KEY FK_E54CB99F2989F1FD');$this->addSql('DROP INDEX IDX_E54CB99F2989F1FD ON invoice_repeat_rule');$this->addSql('ALTER TABLE invoice_repeat_rule ADD supplier_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid_binary_ordered_time)\', ADD customer_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid_binary_ordered_time)\', ADD due_date_days SMALLINT NOT NULL, ADD currency VARCHAR(255) NOT NULL, ADD notes VARCHAR(255) DEFAULT NULL, ADD items_net_total BIGINT NOT NULL, ADD items_gross_total BIGINT NOT NULL, DROP invoice_id, CHANGE interlude interlude SMALLINT NOT NULL COMMENT \'(DC2Type:invoice_repeat_interval)\', CHANGE display_interval_dates add_interval_dates TINYINT(1) NOT NULL');$this->addSql('ALTER TABLE invoice_repeat_rule ADD CONSTRAINT FK_E54CB99F2ADD6D8C FOREIGN KEY (supplier_id) REFERENCES contact (id)');$this->addSql('ALTER TABLE invoice_repeat_rule ADD CONSTRAINT FK_E54CB99F9395C3F3 FOREIGN KEY (customer_id) REFERENCES contact (id)');$this->addSql('CREATE INDEX IDX_E54CB99F2ADD6D8C ON invoice_repeat_rule (supplier_id)');$this->addSql('CREATE INDEX IDX_E54CB99F9395C3F3 ON invoice_repeat_rule (customer_id)');}public function down(Schema $schema): void{$this->addSql('DROP TABLE invoice_repeat_rule_item');$this->addSql('ALTER TABLE invoice_draft DROP repeat_invoice, DROP due_date_days, DROP active_from, DROP active_to, DROP interlude, DROP add_interval_dates');$this->addSql('ALTER TABLE invoice_draft_item CHANGE quantity quantity INT NOT NULL, CHANGE unit_price unit_price INT NOT NULL, CHANGE vat vat INT NOT NULL');$this->addSql('ALTER TABLE invoice_repeat_rule DROP FOREIGN KEY FK_E54CB99F2ADD6D8C');$this->addSql('ALTER TABLE invoice_repeat_rule DROP FOREIGN KEY FK_E54CB99F9395C3F3');$this->addSql('DROP INDEX IDX_E54CB99F2ADD6D8C ON invoice_repeat_rule');$this->addSql('DROP INDEX IDX_E54CB99F9395C3F3 ON invoice_repeat_rule');$this->addSql('ALTER TABLE invoice_repeat_rule ADD invoice_id BINARY(16) NOT NULL COMMENT \'(DC2Type:invoice_id)\', DROP supplier_id, DROP customer_id, DROP due_date_days, DROP currency, DROP notes, DROP items_net_total, DROP items_gross_total, CHANGE interlude interlude INT NOT NULL, CHANGE add_interval_dates display_interval_dates TINYINT(1) NOT NULL');$this->addSql('ALTER TABLE invoice_repeat_rule ADD CONSTRAINT FK_E54CB99F2989F1FD FOREIGN KEY (invoice_id) REFERENCES invoice (id)');$this->addSql('CREATE INDEX IDX_E54CB99F2989F1FD ON invoice_repeat_rule (invoice_id)');}public function preUp(Schema $schema): void{$this->connection->executeQuery('DELETE FROM invoice_repeat_rule');}}