Skip to content

Commit a975ae2

Browse files
committed
Migrations fixes + supplement
1 parent 63eee2e commit a975ae2

File tree

10 files changed

+80
-36
lines changed

10 files changed

+80
-36
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ jobs:
3535
- echo "memory_limit=4096M" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
3636
- echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
3737

38+
- mkdir -p tests/Application/public/media/image/
3839
- cp migrations/* tests/Application/src/Migrations/
40+
3941
install:
4042
- composer update --no-interaction --prefer-dist
4143
- (cd tests/Application && yarn install)

behat.yml.dist

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,3 @@ default:
4141
class: Tests\Sylius\RefundPlugin\Application\Kernel
4242

4343
FriendsOfBehat\VariadicExtension: ~
44-
45-
FriendsOfBehat\SuiteSettingsExtension:
46-
paths:
47-
- "features"

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"require": {
2222
"php": "^7.2",
2323
"knplabs/knp-snappy-bundle": "^1.5",
24-
"sylius/sylius": "~1.4.0",
24+
"sylius/sylius": "^1.4",
2525
"symfony/messenger": "^4.2"
2626
},
2727
"require-dev": {
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
#knp_snappy:
2-
# pdf:
3-
# binary: "%kernel.project_dir%/etc/wkhtmltopdf"
1+
knp_snappy:
2+
pdf:
3+
binary: "%kernel.project_dir%/etc/wkhtmltopdf"

tests/Application/src/Migrations/Version20170912085504.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,15 @@
44

55
namespace DoctrineMigrations;
66

7-
use Doctrine\DBAL\Migrations\AbstractMigration;
7+
use Doctrine\Migrations\AbstractMigration;
88
use Doctrine\DBAL\Schema\Schema;
99

1010
/**
1111
* Auto-generated Migration: Please modify to your needs!
1212
*/
1313
class Version20170912085504 extends AbstractMigration
1414
{
15-
/**
16-
* @param Schema $schema
17-
*/
18-
public function up(Schema $schema)
15+
public function up(Schema $schema): void
1916
{
2017
// this up() migration is auto-generated, please modify it to your needs
2118
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
@@ -185,10 +182,7 @@ public function up(Schema $schema)
185182
$this->addSql('ALTER TABLE sylius_admin_api_refresh_token ADD CONSTRAINT FK_9160E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES sylius_admin_user (id)');
186183
}
187184

188-
/**
189-
* @param Schema $schema
190-
*/
191-
public function down(Schema $schema)
185+
public function down(Schema $schema): void
192186
{
193187
// this down() migration is auto-generated, please modify it to your needs
194188
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

tests/Application/src/Migrations/Version20170913125128.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,15 @@
44

55
namespace DoctrineMigrations;
66

7-
use Doctrine\DBAL\Migrations\AbstractMigration;
7+
use Doctrine\Migrations\AbstractMigration;
88
use Doctrine\DBAL\Schema\Schema;
99

1010
/**
1111
* Auto-generated Migration: Please modify to your needs!
1212
*/
1313
class Version20170913125128 extends AbstractMigration
1414
{
15-
/**
16-
* @param Schema $schema
17-
*/
18-
public function up(Schema $schema)
15+
public function up(Schema $schema): void
1916
{
2017
// this up() migration is auto-generated, please modify it to your needs
2118
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
@@ -44,10 +41,7 @@ public function up(Schema $schema)
4441
$this->addSql('ALTER TABLE sylius_order_item CHANGE product_name product_name VARCHAR(255) DEFAULT NULL, CHANGE variant_name variant_name VARCHAR(255) DEFAULT NULL');
4542
}
4643

47-
/**
48-
* @param Schema $schema
49-
*/
50-
public function down(Schema $schema)
44+
public function down(Schema $schema): void
5145
{
5246
// this down() migration is auto-generated, please modify it to your needs
5347
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

tests/Application/src/Migrations/Version20171003103916.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace DoctrineMigrations;
66

7-
use Doctrine\DBAL\Migrations\AbstractMigration;
7+
use Doctrine\Migrations\AbstractMigration;
88
use Doctrine\DBAL\Schema\Schema;
99
use Sylius\Component\Attribute\AttributeType\SelectAttributeType;
1010
use Sylius\Component\Product\Model\ProductAttributeInterface;
@@ -29,9 +29,6 @@ public function setContainer(?ContainerInterface $container = null): void
2929
$this->container = $container;
3030
}
3131

32-
/**
33-
* @param Schema $schema
34-
*/
3532
public function up(Schema $schema): void
3633
{
3734
// this up() migration is auto-generated, please modify it to your needs
@@ -65,9 +62,6 @@ public function up(Schema $schema): void
6562
}
6663
}
6764

68-
/**
69-
* @param Schema $schema
70-
*/
7165
public function down(Schema $schema): void
7266
{
7367
// this down() migration is auto-generated, please modify it to your needs

tests/Application/src/Migrations/Version20180102140039.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@
44

55
namespace DoctrineMigrations;
66

7-
use Doctrine\DBAL\Migrations\AbstractMigration;
7+
use Doctrine\Migrations\AbstractMigration;
88
use Doctrine\DBAL\Schema\Schema;
99

1010
/**
1111
* Auto-generated Migration: Please modify to your needs!
1212
*/
1313
class Version20180102140039 extends AbstractMigration
1414
{
15-
public function up(Schema $schema)
15+
public function up(Schema $schema): void
1616
{
1717
// this up() migration is auto-generated, please modify it to your needs
1818
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
1919

2020
$this->addSql('CREATE INDEX IDX_16C8119EE551C011 ON sylius_channel (hostname)');
2121
}
2222

23-
public function down(Schema $schema)
23+
public function down(Schema $schema): void
2424
{
2525
// this down() migration is auto-generated, please modify it to your needs
2626
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace DoctrineMigrations;
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+
class Version20190109095211 extends AbstractMigration
14+
{
15+
public function up(Schema $schema): void
16+
{
17+
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
18+
19+
$this->addSql('CREATE TABLE sylius_shop_billing_data (id INT AUTO_INCREMENT NOT NULL, company VARCHAR(255) DEFAULT NULL, tax_id VARCHAR(255) DEFAULT NULL, country_code VARCHAR(255) DEFAULT NULL, street VARCHAR(255) DEFAULT NULL, city VARCHAR(255) DEFAULT NULL, postcode VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET UTF8 COLLATE UTF8_unicode_ci ENGINE = InnoDB');
20+
$this->addSql('ALTER TABLE sylius_channel ADD shop_billing_data_id INT DEFAULT NULL');
21+
$this->addSql('ALTER TABLE sylius_channel ADD CONSTRAINT FK_16C8119EB5282EDF FOREIGN KEY (shop_billing_data_id) REFERENCES sylius_shop_billing_data (id) ON DELETE CASCADE');
22+
$this->addSql('CREATE UNIQUE INDEX UNIQ_16C8119EB5282EDF ON sylius_channel (shop_billing_data_id)');
23+
}
24+
25+
public function down(Schema $schema): void
26+
{
27+
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
28+
29+
$this->addSql('ALTER TABLE sylius_channel DROP FOREIGN KEY FK_16C8119EB5282EDF');
30+
$this->addSql('DROP TABLE sylius_shop_billing_data');
31+
$this->addSql('DROP INDEX UNIQ_16C8119EB5282EDF ON sylius_channel');
32+
$this->addSql('ALTER TABLE sylius_channel DROP shop_billing_data_id');
33+
}
34+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace DoctrineMigrations;
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 Version20190109160409 extends AbstractMigration
14+
{
15+
public function up(Schema $schema): void
16+
{
17+
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
18+
19+
$this->addSql('ALTER TABLE sylius_shop_user ADD encoder_name VARCHAR(255) DEFAULT NULL');
20+
$this->addSql('ALTER TABLE sylius_admin_user ADD encoder_name VARCHAR(255) DEFAULT NULL');
21+
}
22+
23+
public function down(Schema $schema): void
24+
{
25+
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
26+
27+
$this->addSql('ALTER TABLE sylius_admin_user DROP encoder_name');
28+
$this->addSql('ALTER TABLE sylius_shop_user DROP encoder_name');
29+
}
30+
}

0 commit comments

Comments
 (0)