diff --git a/.github/workflows/recipe.yaml b/.github/workflows/recipe.yaml index 3b0c2712..441f36fb 100644 --- a/.github/workflows/recipe.yaml +++ b/.github/workflows/recipe.yaml @@ -20,12 +20,14 @@ jobs: fail-fast: false matrix: php: ['7.4' ,'8.0'] - sylius: ["~1.8.0", "~1.9.0", "~1.10.0"] + sylius: ["~1.8.0", "~1.9.0", "~1.10.0", "~1.11.0"] exclude: - php: 8.0 sylius: "~1.8.0" - php: 8.0 sylius: "~1.9.0" + - php: 7.4 + sylius: "~1.11.0" steps: - name: Setup PHP @@ -55,9 +57,6 @@ jobs: key: composer2-php:${{ matrix.php }}-sylius:${{ matrix.sylius }}-${{ github.sha }} restore-keys: composer2-php:${{ matrix.php }}-sylius:${{ matrix.sylius }}- - - name: Composer v2 - run: sudo composer self-update --2 - - name: Composer Github Auth run: composer config -g github-oauth.github.com ${{ github.token }} @@ -65,6 +64,12 @@ jobs: run: | composer create-project --prefer-dist --no-scripts --no-progress --no-install sylius/sylius-standard sylius "${{ matrix.sylius }}" + # Because the sylius-standard has a soft constraint + - name: Make sure to install the required version of Sylius + working-directory: ./sylius + run: | + composer require --no-install --no-scripts --no-progress sylius/sylius="${{ matrix.sylius }}" + - name: Setup some requirements working-directory: ./sylius run: | diff --git a/.github/workflows/security.yaml b/.github/workflows/security.yaml index 25f0c26a..19e93832 100644 --- a/.github/workflows/security.yaml +++ b/.github/workflows/security.yaml @@ -34,10 +34,6 @@ jobs: restore-keys: composer2-php:${{ matrix.php }}- - run: mkdir -p /home/runner/{.composer/cache,.config/composer} - if: steps.cache-composer.outputs.cache-hit != 'true' - - - name: Composer v2 - run: sudo composer self-update --2 - name: Composer Github Auth run: composer config -g github-oauth.github.com ${{ github.token }} diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 475a0f4b..8c19b121 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - php: ['7.4', '8.0'] + php: ['8.0'] env: SYMFONY_ARGS: --no-tls @@ -48,10 +48,6 @@ jobs: restore-keys: composer2-php:${{ matrix.php }}- - run: mkdir -p /home/runner/{.composer/cache,.config/composer} - if: steps.cache-composer.outputs.cache-hit != 'true' - - - name: Composer v2 - run: sudo composer self-update --2 - name: Composer Github Auth run: composer config -g github-oauth.github.com ${{ github.token }} diff --git a/Makefile b/Makefile index 7927faa4..3f0dac23 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ .DEFAULT_GOAL := help SHELL=/bin/bash APP_DIR=tests/Application -SYLIUS_VERSION=1.10.0 +SYLIUS_VERSION=1.11.0 SYMFONY=cd ${APP_DIR} && symfony COMPOSER=symfony composer CONSOLE=${SYMFONY} console diff --git a/composer.json b/composer.json index 3a81d10c..bc9e86e6 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ "php": "~7.4|~8.0", "ext-json": "*", "ext-intl": "*", - "sylius/sylius": ">=1.8 <1.11" + "sylius/sylius": ">=1.8 <1.12" }, "require-dev": { "behat/behat": "^3.6.1", diff --git a/dist/src/Migrations/Version20220621100423.php b/dist/src/Migrations/Version20220621100423.php new file mode 100644 index 00000000..097b6815 --- /dev/null +++ b/dist/src/Migrations/Version20220621100423.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace App\Migrations; + +use Doctrine\DBAL\Schema\Schema; +use Doctrine\Migrations\AbstractMigration; + +/** + * Auto-generated Migration: Please modify to your needs! + */ +final class Version20220621100423 extends AbstractMigration +{ + public function getDescription(): string + { + return 'Change length of messenger_messages.queue_name column and create missing indexes, cf https://github.com/Sylius/Sylius/issues/13838'; + } + + public function up(Schema $schema): void + { + if ($schema->hasTable('messenger_messages')) { + $this->addSql('ALTER TABLE messenger_messages CHANGE queue_name queue_name VARCHAR(190) NOT NULL'); + if (!$this->tableHasIndexOnColumns('messenger_messages', ['queue_name'])) { + $this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name)'); + } + if (!$this->tableHasIndexOnColumns('messenger_messages', ['available_at'])) { + $this->addSql('CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at)'); + } + } + } + + public function down(Schema $schema): void + { + if ($schema->hasTable('messenger_messages')) { + if ($this->tableHasIndexOnColumns('messenger_messages', ['queue_name'])) { + $this->addSql('DROP INDEX IDX_75EA56E0FB7336F0 ON messenger_messages'); + } + if ($this->tableHasIndexOnColumns('messenger_messages', ['available_at'])) { + $this->addSql('DROP INDEX IDX_75EA56E0E3BD61CE ON messenger_messages'); + } + $this->addSql('ALTER TABLE messenger_messages CHANGE queue_name queue_name VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`'); + } + } + + private function tableHasIndexOnColumns(string $table, array $columns): bool + { + $indexes = $this->connection->getSchemaManager()->listTableIndexes($table); + foreach ($indexes as $index) { + foreach ($index->getColumns() as $column) { + // Another column exists in index + if (($key = array_search($column, $columns, true)) === false) { + continue 2; + } + unset($columns[$key]); + } + } + + // Table has all columns in index if the given array in empty at the end + return empty($columns); + } +}