Sylius: Unable to do a fresh install with postgres

Created on 16 Sep 2020  路  7Comments  路  Source: Sylius/Sylius

Sylius version affected: 1.8.0

Description

See https://github.com/Sylius/Sylius/issues/8853

Steps to reproduce

Follow the install step with a PostgreSQL server instead of MySQL.

Possible Solution

Go back to the old migration system where Migration files were in src/Migrations instead of each package.

Most helpful comment

Why is something so specific version within the project? We have to remove this via CompilerPass. Users should decide, which database will be used.

All 7 comments

I have the same problem :(
The problem is in \Sylius\Bundle\CoreBundle\DependencyInjection\SyliusCoreExtension::prependDoctrineMigrations and \Sylius\Bundle\AdminApiBundle\DependencyInjection\SyliusAdminApiExtension::prependDoctrineMigrations - it tries to register migrations namespaces form Core and API that are for mysql only :(

Why is something so specific version within the project? We have to remove this via CompilerPass. Users should decide, which database will be used.

We should do an opt-out option in the new migration system during the next two weeks. Sorry, for your inconvenience. Stay tuned.

My company wants a new website with integrated shop. Having several years of experience with symfony, we decided to give Sylius Shop and its CMS and Blog plugins a try.

I tried to install the shop last weekend but it fails and says that Migration can only be executed safely on 'mysql'.
Going through the issues shows that the problem exists for more than 3 years.

Postgresql is one of the major RDBMS and has some more advanced features than MySql or MariaDB, so postgresql SHOULD be a first class citizen of Sylius.

Since we really have to start building the new website, please fix this issue and document the solutions. Please don't get me wrong, we would love to try Sylius, but if there isn't support for postgresql we have to look for other solutions. Having the installation fail at the first steps isn't a good start.

@remoteclient you should generate fresh migrations and use this one to remove MySQL one https://gist.github.com/jelen07/7870f622d14e451f627fca8e4d03dbfc
I'm currently using postgresql in my shop, so if you will need help just PM me on sylius slack ;)

@nediam thank you for your suggestion. I implemented the CompilerPass and I was able to generate fresh migrations.

The installation went through, but it says at the end that there were errors, but not which kind of errors:
Bildschirmfoto von 2021-01-15 23-28-57

Looking at the frontend, it looks good. But after login to the backend I get the following error:

An exception has been thrown during the rendering of a template ("An exception occurred while executing 'SELECT SUM(s0_.total) AS sclr_0, EXTRACT(YEAR FROM s0_.checkout_completed_at) AS sclr_1, EXTRACT(MONTH FROM s0_.checkout_completed_at) AS sclr_2 FROM sylius_order s0_ WHERE s0_.payment_state = ? AND s0_.channel_id = ? GROUP BY sclr_1, sclr_2 HAVING (sclr_1 = ? AND sclr_1 = ? AND sclr_2 >= ? AND sclr_2 <= ?) OR (sclr_1 = ? AND sclr_1 <> ? AND sclr_2 >= ?) OR (sclr_1 = ? AND sclr_1 <> ? AND sclr_2 <= ?) OR (sclr_1 > ? AND sclr_1 < ?)' with params ["paid", 1, "2021", "2022", "1", "1", "2021", "2022", "1", "2022", "2021", "1", "2021", "2022"]:
SQLSTATE[42703]: Undefined column: 7 FEHLER: Spalte 禄sclr_1芦 existiert nicht
LINE 1: ..._.channel_id = $2 GROUP BY sclr_1, sclr_2 HAVING (sclr_1 = $...
^").

I looked in the database and the column exists. I am on a fresh install of Sylius Version 1.8.8

Hey folks,

migration toggling has been added in #12060 and is available since v1.8.6. You can turn it off with the following config:

sylius_core:
    prepend_doctrine_migrations: false

According to the admin page issue, it may be related to MySQL specific functions used in the default implementation of \Sylius\Bundle\AdminBundle\Provider\StatisticsDataProviderInterface. Implementing some service and returning empty data should be enough to keep things working.

It is no doubt, that Postgres support could be better, but that would require bigger effort from the community at this moment I suppose. We should create a separate build trigger, that would use Postgres instead of MySql

Was this page helpful?
0 / 5 - 0 ratings