Skip to content

Commit

Permalink
bug #170 Various fixes including doctrine mapping exception (loevgaard)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.0-dev branch.

Discussion
----------

Fixes #169 

Commits
-------

6219b1e Be explicit about column names
de7f8da Be consistent about column names in credit memo
c23b38e Be consistent about column names in refund
f62c4e2 Fixed error: Root image path not resolvable "/path/to/project/public/media/image"
258be3c Added migration
  • Loading branch information
Zales0123 authored Dec 18, 2019
2 parents db2fb3b + 258be3c commit dd7a744
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 5 deletions.
31 changes: 31 additions & 0 deletions migrations/Version20191217075815.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

final class Version20191217075815 extends AbstractMigration
{
public function up(Schema $schema) : void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('DROP INDEX IDX_5C4F3331989A8203 ON sylius_refund_credit_memo');
$this->addSql('ALTER TABLE sylius_refund_credit_memo CHANGE orderNumber order_number VARCHAR(255) NOT NULL, CHANGE currencyCode currency_code VARCHAR(255) NOT NULL, CHANGE localeCode locale_code VARCHAR(255) NOT NULL');
$this->addSql('CREATE INDEX IDX_5C4F3331551F0F81 ON sylius_refund_credit_memo (order_number)');
$this->addSql('ALTER TABLE sylius_refund_refund CHANGE ordernumber order_number VARCHAR(255) NOT NULL');
}

public function down(Schema $schema) : void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('DROP INDEX IDX_5C4F3331551F0F81 ON sylius_refund_credit_memo');
$this->addSql('ALTER TABLE sylius_refund_credit_memo CHANGE order_number orderNumber VARCHAR(255) CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`, CHANGE currency_code currencyCode VARCHAR(255) CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`, CHANGE locale_code localeCode VARCHAR(255) CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`');
$this->addSql('CREATE INDEX IDX_5C4F3331989A8203 ON sylius_refund_credit_memo (orderNumber)');
$this->addSql('ALTER TABLE sylius_refund_refund CHANGE order_number orderNumber VARCHAR(255) CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`');
}
}
8 changes: 4 additions & 4 deletions src/Resources/config/doctrine/CreditMemo.orm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
<id name="id" column="id" type="string" />

<field name="number" />
<field name="orderNumber" />
<field name="orderNumber" column="order_number" />
<field name="total" type="integer" />
<field name="units" type="json" />
<field name="currencyCode" />
<field name="localeCode" />
<field name="currencyCode" column="currency_code" />
<field name="localeCode" column="locale_code" />
<field name="comment" type="text" />
<field name="issuedAt" column="issued_at" type="datetime" nullable="true" />

Expand All @@ -37,7 +37,7 @@
</one-to-one>

<indexes>
<index columns="orderNumber" />
<index columns="order_number" />
</indexes>
</mapped-superclass>
</doctrine-mapping>
2 changes: 1 addition & 1 deletion src/Resources/config/doctrine/Refund.orm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<generator strategy="AUTO" />
</id>

<field name="orderNumber"/>
<field name="orderNumber" column="order_number" />
<field name="amount" type="integer" />
<field name="refundedUnitId" type="integer" nullable="true" column="refunded_unit_id"/>
<field name="type" type="sylius_refund_refund_type" />
Expand Down
Empty file.

0 comments on commit dd7a744

Please sign in to comment.