KatjaGlassConsulting / ApprovalBundle

A Kimai Plugin to manage weekly approval workflow
MIT License
11 stars 14 forks source link

DB Error during installation #35

Closed metzgerd closed 4 months ago

metzgerd commented 4 months ago

Kimai Version: 2.10.0 Approval Version: 2.0.2

During installation of the bundle I got the following error:

sudo docker exec kimai-kimai-1 /opt/kimai/bin/console kimai:bundle:approval:install

Starting installation of plugin: ApprovalBundle ...
===================================================

[notice] Migrating up to ApprovalBundle\Migrations\Version20231016134127
[error] Migration ApprovalBundle\Migrations\Version20221118162725 failed during Execution. Error: "An exception occurred while executing a query: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'kimai.ap.end_date' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by"
 [ERROR] Failed to install database for bundle ApprovalBundle. An exception
         occurred while executing a query: SQLSTATE[42000]: Syntax error or
         access violation: 1055 Expression #3 of SELECT list is not in GROUP BY
         clause and contains nonaggregated column 'kimai.ap.end_date' which is
         not functionally dependent on columns in GROUP BY clause; this is
         incompatible with sql_mode=only_full_group_by 

When I try to start installation again I get the following error:

sudo docker exec kimai-kimai-1 /opt/kimai/bin/console kimai:bundle:approval:install

Starting installation of plugin: ApprovalBundle ...
===================================================

[notice] Migrating up to ApprovalBundle\Migrations\Version20231016134127
[error] Migration ApprovalBundle\Migrations\Version20221118162725 failed during Execution. Error: "An exception occurred while executing a query: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'kimai2_ext_approval_workday_history' already exists"
 [ERROR] Failed to install database for bundle ApprovalBundle. An exception
         occurred while executing a query: SQLSTATE[42S01]: Base table or view
         already exists: 1050 Table 'kimai2_ext_approval_workday_history' 

I've testet the App and started an approval request and do get an db errer / missing table issue: kimai-1 | [2024-02-19T20:19:29.643313+00:00] request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\TableNotFoundException: "An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'kimai.kimai2_ext_approval_overtime_history' doesn't exist" at ExceptionConverter.php line 49 {"exception":"[object] (Doctrine\\DBAL\\Exception\\TableNotFoundException(code: 1146): An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'kimai.kimai2_ext_approval_overtime_history' doesn't exist at /opt/kimai/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php:49)\n[previous exception] [object] (Doctrine\\DBAL\\Driver\\PDO\\Exception(code: 1146): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'kimai.kimai2_ext_approval_overtime_history' doesn't exist at /opt/kimai/vendor/doctrine/dbal/src/Driver/PDO/Exception.php:28)\n[previous exception] [object] (PDOException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'kimai.kimai2_ext_approval_overtime_history' doesn't exist at /opt/kimai/vendor/doctrine/dbal/src/Driver/PDO/Statement.php:130)"} {"channel":"request"}

The lockdown per user plugin I've installed after the installation of the approval bundle. Maybe this caused the issue.

For now I disabled the Apps.

sudo touch plugins/ApprovalBundle/.disabled
sudo touch plugins/LockdownPerUserBundle/.disabled
KatjaGlassConsulting commented 4 months ago

Please retry the update from the main branch. Depending on the strictness of SQL mappings this error did occur in your installation. The migrations have been fixed and for this in your settings this issue should no longer appear.

Please provide feedback.

metzgerd commented 4 months ago

Thank you for the quick response. That fixed my issue.