migrations/2021/01/Version20210126205527.php line 1
<?phpdeclare(strict_types=1);namespace DoctrineMigrations;use Doctrine\DBAL\Schema\Schema;use Doctrine\Migrations\AbstractMigration;final class Version20210126205527 extends AbstractMigration{public function up(Schema $schema): void{$this->addSql('CREATE TABLE document_template (id BINARY(16) NOT NULL COMMENT \'(DC2Type:document_template_id)\', name VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, preview_image VARCHAR(255) NOT NULL, filename VARCHAR(255) NOT NULL, formats LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\', contact_types_by LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\', contact_types_for LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');$this->addSql('CREATE TABLE document_template_permission (id BINARY(16) NOT NULL COMMENT \'(DC2Type:document_template_permission_id)\', contact_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid_binary_ordered_time)\', document_template_id BINARY(16) NOT NULL COMMENT \'(DC2Type:document_template_id)\', INDEX IDX_1B58531EE7A1254A (contact_id), INDEX IDX_1B58531E877338D2 (document_template_id), UNIQUE INDEX UNIQ_1B58531EE7A1254A877338D2 (contact_id, document_template_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');$this->addSql('ALTER TABLE document_template_permission ADD CONSTRAINT FK_1B58531EE7A1254A FOREIGN KEY (contact_id) REFERENCES contact (id)');$this->addSql('ALTER TABLE document_template_permission ADD CONSTRAINT FK_1B58531E877338D2 FOREIGN KEY (document_template_id) REFERENCES document_template (id)');}public function down(Schema $schema): void{$this->addSql('ALTER TABLE document_template_permission DROP FOREIGN KEY FK_1B58531E877338D2');$this->addSql('DROP TABLE document_template');$this->addSql('DROP TABLE document_template_permission');}public function postUp(Schema $schema): void{$this->connection->executeQuery('INSERT INTO document_template (id, name, filename, preview_image, formats, contact_types_by, contact_types_for) VALUES (0x11eaba047bcf5942b3de0242ac130004, "Power of Attorney - Establish company and bank account in Norway", "power-of-attorney", "3rptck5eg427lb7ng28am16004.png", "[\\"pdf\\"]", "[\\"1\\"]", "[\\"1\\",\\"2\\"]")');$this->connection->executeQuery('INSERT INTO document_template (id, name, filename, preview_image, formats, contact_types_by, contact_types_for) VALUES (0x11eababe778b72a2b3de0242ac130004, "Letter", "letter", "3nhdpa5elu27lb7ng28am16004.png", "[\\"pdf\\",\\"docx\\"]", "[\\"1\\"]", "[\\"1\\",\\"2\\"]")');$this->connection->executeQuery('INSERT INTO document_template (id, name, filename, preview_image, formats, contact_types_by, contact_types_for) VALUES (0x11eabcfee102952a82463448ed126851, "Contract", "contract", "710aailf7u27l84hhk93mh4q2h.png", "[\\"pdf\\"]", "[\\"1\\"]", "[\\"2\\"]")');$this->connection->executeQuery('INSERT INTO document_template (id, name, filename, preview_image, formats, contact_types_by, contact_types_for) VALUES (0x11eabfc293f98344b3de0242ac130004, "Helsetrygdkort letter", "helsetrygdkort-application", "4jv61k9fu227lb7ng28am16004.png", "[\\"pdf\\"]", "[\\"1\\"]", "[\\"2\\"]")');}}