Sylius: AbortMigrationException on fresh install with postgres

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Sylius version 1.0.0
Posgres verison 9.6.5
Host Distributor ID: Ubuntu
Description: Ubuntu 17.04
Release: 17.04
Codename: zesty
Station : HPDV7 (646 bits)
PHP Version PHP 7.1.10

How to reproduce

Setup postgres :

$ su postgres
$ psql
# create user sylius LOGIN PASSWORD '1234';
# create database sylius OWNER sylius;
# create database sylius_dev OWNER sylius;

In app/config/parameters.yml:

parameters:
    database_driver: pdo_pgsql
    database_host: 127.0.0.1
    database_port: 5432
    database_name: sylius
    database_user: sylius
    database_password: 1234
   ...

Setup sylius

Follow the standard installation procedure :

$ wget http://getcomposer.org/composer.phar
$ php composer.phar create-project sylius/sylius-standard project
$ cd project
$ yarn install
$ yarn run gulp
$ php bin/console sylius:install

Result

[Doctrine\DBAL\Migrations\AbortMigrationException]
Migration can only be executed safely on ‘mysql’.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 4
  • Comments: 16 (7 by maintainers)

Most upvoted comments

Issue to be reopen, as version 1.8.0 include migrations for mysql only from the packages, so the workaround here is not applicable 😕

@teohhanhui it looks like there’s an incompatibility referenced in #7978.

As long as Sylius doesn’t use any MySQL-specific features or depend on any quirks of MySQL, things should work fine on PostgreSQL. Migrations could be adapted by the users themselves. 😆

I think it’s worth having a section in the docs about using a different DBMS, because currently it’s claimed that you could use something else like PostgreSQL, but the user is left hanging.

Overall, to properly support PostgreSQL we would need to run tests on both databases and provide additional fixtures, which is something we don’t have enough resources to do right now. The solution here might be to start up a community project providing support for PostgreSQL-based migrations made by people who actually use it.

@teohhanhui this way works only for a fresh installation, migrations often include more complicated, hand-made transformations to make upgrades effortless.

This is the workaround I used in a fresh Sylius-Standard project:

  1. Remove all migrations from app/migrations
  2. bin/console doctrine:migrations:diff
  3. bin/console doctrine:migrations:migrate
  4. Profit(?)