From 31909f9a0829ca8b66f1ad7c1562f688679cf973 Mon Sep 17 00:00:00 2001 From: TheMilek Date: Tue, 3 Feb 2026 11:43:45 +0100 Subject: [PATCH 1/3] Add migration supporting PostgreSQL --- src/Migrations/Version20260203103556.php | 70 ++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 src/Migrations/Version20260203103556.php diff --git a/src/Migrations/Version20260203103556.php b/src/Migrations/Version20260203103556.php new file mode 100644 index 00000000..9984b79f --- /dev/null +++ b/src/Migrations/Version20260203103556.php @@ -0,0 +1,70 @@ +hasTable('sylius_wishlist') || $schema->hasTable('bitbag_wishlist')) { + return; + } + + $this->addSql('CREATE SEQUENCE sylius_wishlist_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE sylius_wishlist_product_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE TABLE sylius_wishlist (id INT NOT NULL, shop_user_id INT DEFAULT NULL, channel_id INT DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, token VARCHAR(255) NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_635A71DEA45D93BF ON sylius_wishlist (shop_user_id)'); + $this->addSql('CREATE INDEX IDX_635A71DE72F5A1AA ON sylius_wishlist (channel_id)'); + $this->addSql('CREATE INDEX token_idx ON sylius_wishlist (token)'); + $this->addSql('CREATE INDEX channel_shop_user_token_idx ON sylius_wishlist (channel_id, shop_user_id, token)'); + $this->addSql('CREATE TABLE sylius_wishlist_product (id INT NOT NULL, wishlist_id INT NOT NULL, product_id INT DEFAULT NULL, variant_id INT DEFAULT NULL, quantity INT DEFAULT 1 NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_8D0D7C6DFB8E54CD ON sylius_wishlist_product (wishlist_id)'); + $this->addSql('CREATE INDEX IDX_8D0D7C6D4584665A ON sylius_wishlist_product (product_id)'); + $this->addSql('CREATE INDEX IDX_8D0D7C6D3B69A9AF ON sylius_wishlist_product (variant_id)'); + $this->addSql('ALTER TABLE sylius_wishlist ADD CONSTRAINT FK_635A71DEA45D93BF FOREIGN KEY (shop_user_id) REFERENCES sylius_shop_user (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE sylius_wishlist ADD CONSTRAINT FK_635A71DE72F5A1AA FOREIGN KEY (channel_id) REFERENCES sylius_channel (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE sylius_wishlist_product ADD CONSTRAINT FK_8D0D7C6DFB8E54CD FOREIGN KEY (wishlist_id) REFERENCES sylius_wishlist (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE sylius_wishlist_product ADD CONSTRAINT FK_8D0D7C6D4584665A FOREIGN KEY (product_id) REFERENCES sylius_product (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE sylius_wishlist_product ADD CONSTRAINT FK_8D0D7C6D3B69A9AF FOREIGN KEY (variant_id) REFERENCES sylius_product_variant (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('DROP INDEX idx_75ea56e016ba31db'); + $this->addSql('DROP INDEX idx_75ea56e0e3bd61ce'); + $this->addSql('DROP INDEX idx_75ea56e0fb7336f0'); + $this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0E3BD61CE16BA31DBBF396750 ON messenger_messages (queue_name, available_at, delivered_at, id)'); + } + + public function down(Schema $schema): void + { + $this->addSql('DROP SEQUENCE sylius_wishlist_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE sylius_wishlist_product_id_seq CASCADE'); + $this->addSql('ALTER TABLE sylius_wishlist DROP CONSTRAINT FK_635A71DEA45D93BF'); + $this->addSql('ALTER TABLE sylius_wishlist DROP CONSTRAINT FK_635A71DE72F5A1AA'); + $this->addSql('ALTER TABLE sylius_wishlist_product DROP CONSTRAINT FK_8D0D7C6DFB8E54CD'); + $this->addSql('ALTER TABLE sylius_wishlist_product DROP CONSTRAINT FK_8D0D7C6D4584665A'); + $this->addSql('ALTER TABLE sylius_wishlist_product DROP CONSTRAINT FK_8D0D7C6D3B69A9AF'); + $this->addSql('DROP TABLE sylius_wishlist'); + $this->addSql('DROP TABLE sylius_wishlist_product'); + $this->addSql('DROP INDEX IDX_75EA56E0FB7336F0E3BD61CE16BA31DBBF396750'); + $this->addSql('CREATE INDEX idx_75ea56e016ba31db ON messenger_messages (delivered_at)'); + $this->addSql('CREATE INDEX idx_75ea56e0e3bd61ce ON messenger_messages (available_at)'); + $this->addSql('CREATE INDEX idx_75ea56e0fb7336f0 ON messenger_messages (queue_name)'); + } +} From 505d1083e466817150155ef738c9d620f5700c29 Mon Sep 17 00:00:00 2001 From: TheMilek Date: Tue, 3 Feb 2026 11:43:55 +0100 Subject: [PATCH 2/3] Update build --- .github/workflows/build.yml | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4701e801..a71d5eba 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,21 +26,37 @@ jobs: tests: runs-on: ubuntu-latest - name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.database_version }}" + name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, ${{ matrix.database == 'mysql' && format('MySQL {0}', matrix.database_version) || format('PostgreSQL {0}', matrix.database_version) }}" strategy: fail-fast: false matrix: php: ["8.3"] - symfony: ["^6.4", "~7.3.0"] - sylius: ["~2.0.7", "~2.1.0"] + symfony: ["^6.4", "~7.4.0"] + sylius: ["~2.1.0", "~2.2.0"] node: ["22.x"] database: ["mysql"] database_version: ["8.4"] + include: + - + php: "8.3" + symfony: "^6.4" + sylius: "~2.1.0" + node: "22.x" + database: "postgres" + database_version: "17.5" + - + php: "8.3" + symfony: "~7.4.0" + sylius: "~2.2.0" + node: "22.x" + database: "postgres" + database_version: "17.5" + env: APP_ENV: test - DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.database_version }}" + DATABASE_URL: ${{ matrix.database == 'mysql' && format('mysql://root:root@127.0.0.1/sylius?serverVersion={0}', matrix.database_version) || format('pgsql://postgres:postgres@127.0.0.1/sylius?serverVersion={0}', matrix.database_version) }} steps: - @@ -93,7 +109,7 @@ jobs: uses: actions/upload-artifact@v4 if: failure() with: - name: "Behat logs - Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}" + name: "Behat logs - Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, ${{ matrix.database }} ${{ matrix.database_version }}" path: etc/build/ if-no-files-found: ignore compression-level: 6 @@ -104,7 +120,7 @@ jobs: uses: actions/upload-artifact@v4 if: failure() with: - name: "Var logs - Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}" + name: "Var logs - Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, ${{ matrix.database }} ${{ matrix.database_version }}" path: tests/Application/var/log/ if-no-files-found: ignore compression-level: 6 From ccf9d93fe9b7f1e41d22aed338364c4203024c3e Mon Sep 17 00:00:00 2001 From: Rafikooo Date: Fri, 13 Mar 2026 14:23:52 +0100 Subject: [PATCH 3/3] Add UPGRADE-1.2.md with PostgreSQL support note --- UPGRADE-1.2.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 UPGRADE-1.2.md diff --git a/UPGRADE-1.2.md b/UPGRADE-1.2.md new file mode 100644 index 00000000..85b1485b --- /dev/null +++ b/UPGRADE-1.2.md @@ -0,0 +1,14 @@ +# UPGRADE FROM 1.1 TO 1.2 + +## PostgreSQL support + +PostgreSQL is now officially supported. A new PostgreSQL-specific migration has been added. + +### If you were already using PostgreSQL + +The initial PostgreSQL migration will detect existing tables and skip creation automatically. +Run migrations as usual: + +```bash +bin/console doctrine:migrations:migrate +```