directus / v8-archive

Directus Database API — Wraps Custom SQL Databases with a REST/GraphQL API
https://docs.directus.io/api/reference.html
507 stars 203 forks source link

You need to enable the PDO_Mysql extension for Phinx to run properly. #820

Closed syslogic closed 5 years ago

syslogic commented 5 years ago

Bug Report

Steps to Reproduce

  1. Run ./directus install:database

Expected Behavior

database table creation.

Actual Behavior

The problem is, that the files from /etc/php-cli.d are by default being loaded in an alphabetical order:

"/usr/bin/php" "/var/www/local.directus/directus/bin/directus" "install:database"
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/pdo_mysqlnd.so' - /usr/lib64/php/modules/pdo_mysqlnd.so: undefined symbol: mysqlnd_allocator in Unknown on line 0
You need to enable the PDO_Mysql extension for Phinx to run properly.
Done.

Once having fixed this and then running the command twice, it should possibly exit gracefully:

"/usr/bin/php" "/var/www/local.directus/directus/bin/directus" "install:database"
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'directus_activity-id' for key 'idx_collection_field'
Done.

Other Context & Screenshots

Symbol mysqlnd_allocator is only defined, when loading these modules in a pre-defined order:

# nano /etc/php-cli.d/mysqlnd.ini
;extension=mysqlnd.so

# nano /etc/php-cli.d/pdo_mysqlnd.ini
extension=mysqlnd.so
extension=pdo_mysqlnd.so

Using *.ini file-names prefixed with their priority would also permit to control their loading order, as cakephp/phinx issue #900 suggests, which is basically the same problem.

Technical Details

benhaynes commented 5 years ago

@rijkvanzanten — any idea if this is an App or API issue?

binal-7span commented 5 years ago

Hey @syslogic

It is obvious that you are getting the duplication error after executing the command twice. Maybe you got the first error in the middle of the execution so some tables might generate already and then you had executed it again; that's why it will throw an error. Which is correct too!

Help me if I misunderstood your issue. Otherwise, it seems like it is not the issue actually!

binal-7span commented 5 years ago

We are closing this issue. Feel free to reopen it.