Sylius: AbortMigrationException on fresh install with postgres

Created on 16 Oct 2017  Â·  16Comments  Â·  Source: Sylius/Sylius

| 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'.

Environment Potential Bug Stale

Most helpful comment

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

All 16 comments

Any information on this issue? 1.0 milestone failed?

I am getting this error too. Does this mean that Sylius isn't compatible with PostgreSQL?

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(?)

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

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.

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. :laughing:

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.

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

@it-all Thanks for the heads up.

Having the same issue :(

@Codealist Please try the workaround above: https://github.com/Sylius/Sylius/issues/8853#issuecomment-379024893

Hello,

I am a Symfony developer and I am in love with the project :heart_eyes_cat: already..

The Migrations scripts are just a bunch of lazy dumps of Mysql database statements and the $schema argument of the component is not in use which would allow installation on any Doctrine-supporting infrastructure.

I would like to fix this and make a pull request to merge it for the future generations.

Would you be OK with this?

I would just need information on how we should do this. I am think to simply edit the Migrations/VersionXXX.php and use DBAL for creating tables and all that is needed.

p.s. I have not tried the workaround yet...

i'm a symfony developer for many years ago
i get same issue
here is how i resolve it
1-go to migration directory in the project under src remove all migration files
2-generate new migration file using "php bin/console make:migration"
3-finaly do this "php bin/console doctrine:migration:migrate"

this works for me :)

image

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in a week if no further activity occurs. Thank you for your contributions.

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

I confirm, switching to mysql in the meantime

Hey @storm1er and @3kynox. Can you try fix provided here: https://github.com/Sylius/Sylius/issues/11851#issuecomment-764952143?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eb22fbb4 picture eb22fbb4  Â·  3Comments

loic425 picture loic425  Â·  3Comments

mikemix picture mikemix  Â·  3Comments

hmonglee picture hmonglee  Â·  3Comments

xleliberty picture xleliberty  Â·  3Comments