migrations/2020/05/Version20200526034520.php line 1
<?phpdeclare(strict_types=1);namespace DoctrineMigrations;use Doctrine\DBAL\Schema\Schema;use Doctrine\Migrations\AbstractMigration;final class Version20200526034520 extends AbstractMigration{public function up(Schema $schema): void{$this->addSql('CREATE TABLE invoice_draft (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid_binary)\', created_by_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid_binary)\', modified_by_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid_binary)\', finished_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid_binary)\', supplier_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid_binary)\', customer_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid_binary)\', credited_invoice_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid_binary)\', created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', modified_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', finished_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', due_date DATE DEFAULT NULL COMMENT \'(DC2Type:date_immutable)\', currency VARCHAR(3) DEFAULT NULL, notes LONGTEXT DEFAULT NULL, items_net_total BIGINT NOT NULL, items_gross_total BIGINT NOT NULL, INDEX IDX_7BA6C621B03A8386 (created_by_id), INDEX IDX_7BA6C62199049ECE (modified_by_id), INDEX IDX_7BA6C6214A12CC70 (finished_by_id), INDEX IDX_7BA6C6212ADD6D8C (supplier_id), INDEX IDX_7BA6C6219395C3F3 (customer_id), INDEX IDX_7BA6C6216A17B032 (credited_invoice_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');$this->addSql('CREATE TABLE invoice_draft_item (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid_binary)\', draft_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid_binary)\', sequence SMALLINT NOT NULL, description VARCHAR(255) DEFAULT NULL, quantity INT NOT NULL, unit_price INT NOT NULL, vat INT NOT NULL, INDEX IDX_FC876384E2F3C5D1 (draft_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');$this->addSql('ALTER TABLE invoice_draft ADD CONSTRAINT FK_7BA6C621B03A8386 FOREIGN KEY (created_by_id) REFERENCES contact (id)');$this->addSql('ALTER TABLE invoice_draft ADD CONSTRAINT FK_7BA6C62199049ECE FOREIGN KEY (modified_by_id) REFERENCES contact (id)');$this->addSql('ALTER TABLE invoice_draft ADD CONSTRAINT FK_7BA6C6214A12CC70 FOREIGN KEY (finished_by_id) REFERENCES contact (id)');$this->addSql('ALTER TABLE invoice_draft ADD CONSTRAINT FK_7BA6C6212ADD6D8C FOREIGN KEY (supplier_id) REFERENCES contact (id)');$this->addSql('ALTER TABLE invoice_draft ADD CONSTRAINT FK_7BA6C6219395C3F3 FOREIGN KEY (customer_id) REFERENCES contact (id)');$this->addSql('ALTER TABLE invoice_draft ADD CONSTRAINT FK_7BA6C6216A17B032 FOREIGN KEY (credited_invoice_id) REFERENCES invoice (id)');$this->addSql('ALTER TABLE invoice_draft_item ADD CONSTRAINT FK_FC876384E2F3C5D1 FOREIGN KEY (draft_id) REFERENCES invoice_draft (id)');}public function down(Schema $schema): void{$this->addSql('ALTER TABLE invoice_draft_item DROP FOREIGN KEY FK_FC876384E2F3C5D1');$this->addSql('DROP TABLE invoice_draft');$this->addSql('DROP TABLE invoice_draft_item');}}