Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mysql 5.7: Installation error with default data on many tables #5

Closed
imami opened this issue Apr 29, 2016 · 6 comments
Closed

Mysql 5.7: Installation error with default data on many tables #5

imami opened this issue Apr 29, 2016 · 6 comments
Labels

Comments

@imami
Copy link

imami commented Apr 29, 2016

during the installation process, there was so many of errors like this.
when I fix one, I get another error for another table/field

Installing data set:default
---------------------------------------------------------------
Data for model DataDefault.Role inserted
Data for model DataDefault.User inserted
could not find key/var/www/html/passbolt/app/Plugin/DataUnitTests/Console/Command/Task/gpg/anonymous_public.key for anonymous@passbolt.com using dummy one.
Data for model DataDefault.Gpgkey inserted
Error: SQLSTATE[HY000]: General error: 1364 Field 'description' doesn't have a default value
#0 /var/www/html/passbolt/lib/Cake/Model/Datasource/DboSource.php(461): PDOStatement->execute(Array)
#1 /var/www/html/passbolt/lib/Cake/Model/Datasource/DboSource.php(427): DboSource->_execute('INSERT INTO `pa...', Array)
#2 /var/www/html/passbolt/lib/Cake/Model/Datasource/DboSource.php(1019): DboSource->execute('INSERT INTO `pa...')
#3 /var/www/html/passbolt/lib/Cake/Model/Model.php(1933): DboSource->create(Object(PermissionType), Array, Array)
#4 /var/www/html/passbolt/lib/Cake/Model/Model.php(1751): Model->_doSave(Array, Array)
#5 /var/www/html/passbolt/app/Console/Command/Task/ModelTask.php(26): Model->save(Array, false)
#6 /var/www/html/passbolt/app/Console/Command/DataShell.php(129): ModelTask->execute()
#7 /var/www/html/passbolt/lib/Cake/Console/Shell.php(458): DataShell->import()
#8 /var/www/html/passbolt/lib/Cake/Console/ShellDispatcher.php(212): Shell->runCommand('import', Array)
#9 /var/www/html/passbolt/lib/Cake/Console/Shell.php(399): ShellDispatcher->dispatch()
#10 /var/www/html/passbolt/app/Console/Command/InstallShell.php(234): Shell->dispatchShell('data import --d...')
#11 /var/www/html/passbolt/app/Console/Command/InstallShell.php(115): InstallShell->data('default')
#12 /var/www/html/passbolt/lib/Cake/Console/Shell.php(461): InstallShell->main()
#13 /var/www/html/passbolt/lib/Cake/Console/ShellDispatcher.php(212): Shell->runCommand('--no-admin', Array)
#14 /var/www/html/passbolt/lib/Cake/Console/ShellDispatcher.php(66): ShellDispatcher->dispatch()
#15 /var/www/html/passbolt/app/Console/cake.php(47): ShellDispatcher::run(Array)
#16 {main}

I finally find the solution in one of this two ways:

A: In app/Config/Schema/schema.php
Replace all
array('type' => 'string', 'null' => false, 'default' => null,
with
array('type' => 'string', 'null' => false, 'default' => '',

B: In this directory app/Plugin/DataDefault/Console/Command/Task/
check files ony by one to fix default data , and add the missing value for some string fields

Obviously I choose the first way for my case. but I think this issue is better to be fixed soon

@stripthis
Copy link
Member

Thank you for this bug report. Can you tell me which operating system and php/mysql versions you are using so that we can reproduce the issue?

@stripthis stripthis added the bug label Apr 29, 2016
@imami
Copy link
Author

imami commented Apr 29, 2016

@stripthis
PHP 7.0.4
Mysql Ver 14.14 Distrib 5.7.12

I've sent the diff file to your email

@stripthis stripthis changed the title Installation error with default data on many tables PHP7: Installation error with default data on many tables Apr 30, 2016
@stripthis
Copy link
Member

@imami Sorry this is taking longer than expected, but this format is actually generated by cakephp schema tools, so it's not something we're willing to change without understanding the full impact. Thanks for your patience.

@anogues
Copy link

anogues commented Jul 14, 2016

Hello.

It happens with Php 5.4 as well. After the fix provided by imami all works.
Using mysql 5.7 also as well.

@stripthis stripthis changed the title PHP7: Installation error with default data on many tables Mysql 5.7: Installation error with default data on many tables Jul 14, 2016
@stripthis
Copy link
Member

stripthis commented Jul 14, 2016

Thanks for the hint @anogues, I think this issue is due to strict mode becoming the default on Mysql 5.7, and the fixtures not enforcing some of the "cannot be null" rules, like with permission_type.description. We'll look into this now that we can reproduce the issue.

@stripthis
Copy link
Member

stripthis commented Aug 8, 2016

@anogues @imami, we released a fix for Mysql5.7 schema issues just now. It will still cause issues with sql_mode only_full_group_by enabled, but it should work fine with strict mode now. Please open a new issue c if you run into issues again! See. https://www.passbolt.com/release/notes#v1.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants