Skip to content

Commit dbe427e

Browse files
author
Maxime
authored
Merge pull request #182 from lanfisis/master
Allow Sylius 1.11
2 parents eb07151 + bfac751 commit dbe427e

File tree

6 files changed

+83
-15
lines changed

6 files changed

+83
-15
lines changed

.github/workflows/recipe.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ jobs:
2020
fail-fast: false
2121
matrix:
2222
php: ['7.4' ,'8.0']
23-
sylius: ["~1.8.0", "~1.9.0", "~1.10.0"]
23+
sylius: ["~1.8.0", "~1.9.0", "~1.10.0", "~1.11.0"]
2424
exclude:
2525
- php: 8.0
2626
sylius: "~1.8.0"
2727
- php: 8.0
2828
sylius: "~1.9.0"
29+
- php: 7.4
30+
sylius: "~1.11.0"
2931

3032
steps:
3133
- name: Setup PHP
@@ -55,16 +57,19 @@ jobs:
5557
key: composer2-php:${{ matrix.php }}-sylius:${{ matrix.sylius }}-${{ github.sha }}
5658
restore-keys: composer2-php:${{ matrix.php }}-sylius:${{ matrix.sylius }}-
5759

58-
- name: Composer v2
59-
run: sudo composer self-update --2
60-
6160
- name: Composer Github Auth
6261
run: composer config -g github-oauth.github.com ${{ github.token }}
6362

6463
- name: Create Sylius-Standard project without install
6564
run: |
6665
composer create-project --prefer-dist --no-scripts --no-progress --no-install sylius/sylius-standard sylius "${{ matrix.sylius }}"
6766
67+
# Because the sylius-standard has a soft constraint
68+
- name: Make sure to install the required version of Sylius
69+
working-directory: ./sylius
70+
run: |
71+
composer require --no-install --no-scripts --no-progress sylius/sylius="${{ matrix.sylius }}"
72+
6873
- name: Setup some requirements
6974
working-directory: ./sylius
7075
run: |

.github/workflows/security.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ jobs:
3434
restore-keys: composer2-php:${{ matrix.php }}-
3535

3636
- run: mkdir -p /home/runner/{.composer/cache,.config/composer}
37-
if: steps.cache-composer.outputs.cache-hit != 'true'
38-
39-
- name: Composer v2
40-
run: sudo composer self-update --2
4137

4238
- name: Composer Github Auth
4339
run: composer config -g github-oauth.github.com ${{ github.token }}

.github/workflows/tests.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
php: ['7.4', '8.0']
19+
php: ['8.0']
2020

2121
env:
2222
SYMFONY_ARGS: --no-tls
@@ -48,10 +48,6 @@ jobs:
4848
restore-keys: composer2-php:${{ matrix.php }}-
4949

5050
- run: mkdir -p /home/runner/{.composer/cache,.config/composer}
51-
if: steps.cache-composer.outputs.cache-hit != 'true'
52-
53-
- name: Composer v2
54-
run: sudo composer self-update --2
5551

5652
- name: Composer Github Auth
5753
run: composer config -g github-oauth.github.com ${{ github.token }}

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.DEFAULT_GOAL := help
22
SHELL=/bin/bash
33
APP_DIR=tests/Application
4-
SYLIUS_VERSION=1.10.0
4+
SYLIUS_VERSION=1.11.0
55
SYMFONY=cd ${APP_DIR} && symfony
66
COMPOSER=symfony composer
77
CONSOLE=${SYMFONY} console

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"php": "~7.4|~8.0",
99
"ext-json": "*",
1010
"ext-intl": "*",
11-
"sylius/sylius": ">=1.8 <1.11"
11+
"sylius/sylius": ">=1.8 <1.12"
1212
},
1313
"require-dev": {
1414
"behat/behat": "^3.6.1",
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php
2+
3+
/*
4+
* This file is part of Monsieur Biz' Rich Editor plugin for Sylius.
5+
*
6+
* (c) Monsieur Biz <sylius@monsieurbiz.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE.txt
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace App\Migrations;
15+
16+
use Doctrine\DBAL\Schema\Schema;
17+
use Doctrine\Migrations\AbstractMigration;
18+
19+
/**
20+
* Auto-generated Migration: Please modify to your needs!
21+
*/
22+
final class Version20220621100423 extends AbstractMigration
23+
{
24+
public function getDescription(): string
25+
{
26+
return 'Change length of messenger_messages.queue_name column and create missing indexes, cf https://github.com/Sylius/Sylius/issues/13838';
27+
}
28+
29+
public function up(Schema $schema): void
30+
{
31+
if ($schema->hasTable('messenger_messages')) {
32+
$this->addSql('ALTER TABLE messenger_messages CHANGE queue_name queue_name VARCHAR(190) NOT NULL');
33+
if (!$this->tableHasIndexOnColumns('messenger_messages', ['queue_name'])) {
34+
$this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name)');
35+
}
36+
if (!$this->tableHasIndexOnColumns('messenger_messages', ['available_at'])) {
37+
$this->addSql('CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at)');
38+
}
39+
}
40+
}
41+
42+
public function down(Schema $schema): void
43+
{
44+
if ($schema->hasTable('messenger_messages')) {
45+
if ($this->tableHasIndexOnColumns('messenger_messages', ['queue_name'])) {
46+
$this->addSql('DROP INDEX IDX_75EA56E0FB7336F0 ON messenger_messages');
47+
}
48+
if ($this->tableHasIndexOnColumns('messenger_messages', ['available_at'])) {
49+
$this->addSql('DROP INDEX IDX_75EA56E0E3BD61CE ON messenger_messages');
50+
}
51+
$this->addSql('ALTER TABLE messenger_messages CHANGE queue_name queue_name VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`');
52+
}
53+
}
54+
55+
private function tableHasIndexOnColumns(string $table, array $columns): bool
56+
{
57+
$indexes = $this->connection->getSchemaManager()->listTableIndexes($table);
58+
foreach ($indexes as $index) {
59+
foreach ($index->getColumns() as $column) {
60+
// Another column exists in index
61+
if (($key = array_search($column, $columns, true)) === false) {
62+
continue 2;
63+
}
64+
unset($columns[$key]);
65+
}
66+
}
67+
68+
// Table has all columns in index if the given array in empty at the end
69+
return empty($columns);
70+
}
71+
}

0 commit comments

Comments
 (0)