Skip to content

Commit fddb1b2

Browse files
author
Jakob Tolkemit
committed
Changed field type of optionValue
1 parent 12baf3d commit fddb1b2

File tree

3 files changed

+37
-6
lines changed

3 files changed

+37
-6
lines changed

src/Migrations/Version20210303184909.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ public function setContainer(?ContainerInterface $container = null)
2525
$this->container = $container;
2626
}
2727

28-
public function getDescription() : string
28+
public function getDescription(): string
2929
{
3030
return '';
3131
}
3232

33-
public function up(Schema $schema) : void
33+
public function up(Schema $schema): void
3434
{
3535
// this up() migration is auto-generated, please modify it to your needs
3636
$this->addSql('CREATE TABLE brille24_customer_option_file_content (id INT AUTO_INCREMENT NOT NULL, content LONGTEXT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET UTF8 COLLATE `UTF8_unicode_ci` ENGINE = InnoDB');
@@ -45,15 +45,15 @@ public function up(Schema $schema) : void
4545
$this->addSql('INSERT INTO brille24_customer_option_file_content (id, content) VALUES(:id, :content)', ['id' => $id, 'content' => $fileContent]);
4646
$this->addSql('UPDATE brille24_customer_option_order_item_option SET fileContent_id = :file_content_id, optionValue = "file-content" WHERE id = :id', ['file_content_id' => $id, 'id' => $orderItemOption['id']]);
4747

48-
$id++;
48+
++$id;
4949
}
5050
}
5151

52-
public function down(Schema $schema) : void
52+
public function down(Schema $schema): void
5353
{
5454
foreach ($this->getOrderItemOptionsWithFileContent() as $orderItemOption) {
5555
$fileContent = $orderItemOption['content'];
56-
$id = $orderItemOption['id'];
56+
$id = $orderItemOption['id'];
5757

5858
$this->addSql('UPDATE brille24_customer_option_order_item_option SET optionValue = :content WHERE id = :id', ['content' => $fileContent, 'id' => $id]);
5959
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Brille24\SyliusCustomerOptionsPlugin\Migrations;
6+
7+
use Doctrine\DBAL\Schema\Schema;
8+
use Doctrine\Migrations\AbstractMigration;
9+
10+
/**
11+
* Auto-generated Migration: Please modify to your needs!
12+
*/
13+
final class Version20210317090200 extends AbstractMigration
14+
{
15+
public function getDescription(): string
16+
{
17+
return '';
18+
}
19+
20+
public function up(Schema $schema): void
21+
{
22+
// this up() migration is auto-generated, please modify it to your needs
23+
$this->addSql('ALTER TABLE brille24_customer_option_order_item_option CHANGE optionValue optionValue VARCHAR(255) DEFAULT NULL');
24+
}
25+
26+
public function down(Schema $schema): void
27+
{
28+
// this down() migration is auto-generated, please modify it to your needs
29+
$this->addSql('ALTER TABLE brille24_customer_option_order_item_option CHANGE optionValue optionValue LONGTEXT CHARACTER SET utf8 DEFAULT NULL COLLATE `utf8_unicode_ci`');
30+
}
31+
}

src/Resources/config/doctrine/OrderItemOption.orm.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
<field name="customerOptionValueCode" nullable="true"/>
2121
<field name="customerOptionValueName" nullable="true"/>
22-
<field name="optionValue" nullable="true" type="text"/>
22+
<field name="optionValue" nullable="true" type="string"/>
2323
<one-to-one field="fileContent" target-entity="Brille24\SyliusCustomerOptionsPlugin\Entity\FileContent">
2424
<cascade>
2525
<cascade-all />

0 commit comments

Comments
 (0)