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

"Cannot add or update a child row: a foreign key constraint fails " for ohrm_user_role_data_group #1780

Closed
yashiscool123 opened this issue Dec 22, 2023 · 7 comments
Labels
5x Issues related to OrangeHRM 5.x versions

Comments

@yashiscool123
Copy link

OrangeHRM version

5.5

Environment details

  • OrangeHRM source: 5.5
  • Platform: Windows
  • PHP version: 8.2.12
  • Database and version: MySQL 10.4.32
  • Web server: XAMPP (Apache)
  • Browser: Chrome
    Instance details: {"os":{"os":"Windows NT","release_name":"10.0","version_info":"build 22621 (Windows 11)"},"php":{"version":"8.2.12"},"mysql":{"client_version":"mysqlnd 8.2.12","server_version":"10.4.32-MariaDB","conn_type":"127.0.0.1 via TCP/IP"},"server":"Apache/2.4.58 (Win64) OpenSSL/3.1.3 PHP/8.2.12","ohrm":{"version":"5.5"}}

Describe the bug

When doing a clean first time installation facing the following issue:

Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (ohrm.ohrm_user_role_data_group, CONSTRAINT ohrm_user_role_data_group_ibfk_1 FOREIGN KEY (user_role_id) REFERENCES ohrm_user_role (id) ON DELETE CASCADE)
installer.log

To reproduce

Do a simple first time installation of XAMPP and then deploy the OHRM in the HTDOCS folder and run the installation as usual in a Windows 11 environment.

Expected behavior

No response

Relevant log output

No response

@yashiscool123 yashiscool123 added the 5x Issues related to OrangeHRM 5.x versions label Dec 22, 2023
@devishke-orange
Copy link
Contributor

devishke-orange commented Jan 1, 2024

Hi @yashiscool123,

This is a known issue. Please see #1731 (comment)

@devishke-orange
Copy link
Contributor

Hi @yashiscool123,

This issue is fixed in OrangeHRM 5.6: https://github.com/orangehrm/orangehrm/releases/tag/v5.6

@yashiscool123
Copy link
Author

The issue is still not fixed. Please find the log attached.
installer.log

@yshah-fluree
Copy link

I can still see this issue persisting. Please find the attached log.
installer.log

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (ohrm.ohrm_user_role_data_group, CONSTRAINT ohrm_user_role_data_group_ibfk_1 FOREIGN KEY (user_role_id) REFERENCES ohrm_user_role (id) ON DELETE CASCADE) [] []

@devishke-orange
Copy link
Contributor

Hi @yashiscool123 , @yshah-fluree

We have identified the cause of this issue. As it turns out, it's due to the timeout defined by XAMPP. Please follow the steps below and let me know if you can install the system.

  1. Open XAMPP and make sure the Apache server is stopped. (Screenshot for reference)
    Screenshot 2024-03-07 074022

  2. In the row of buttons corresponding to Apache, click on "Config".
    Screenshot 2024-03-07 074135

  3. Select "PHP (php.ini)"
    Screenshot 2024-03-07 074249

  4. This will open up Notepad. Click on Notepad and search for a line with the text "max_execution_time"
    Screenshot 2024-03-07 074525

  5. It should be equal to 120 by default. Increase the number to a higher value. Make sure to save the file.
    Screenshot 2024-03-07 074652

  6. Now, restart the Apache server (and MySQL if it's not already started) and try installing OrangeHRM. If it still doesn't work, try increasing the timeout to a higher value.

@yshah-fluree
Copy link

Thank

Hi @yashiscool123 , @yshah-fluree

We have identified the cause of this issue. As it turns out, it's due to the timeout defined by XAMPP. Please follow the steps below and let me know if you can install the system.

  1. Open XAMPP and make sure the Apache server is stopped. (Screenshot for reference)
    Screenshot 2024-03-07 074022
  2. In the row of buttons corresponding to Apache, click on "Config".
    Screenshot 2024-03-07 074135
  3. Select "PHP (php.ini)"
    Screenshot 2024-03-07 074249
  4. This will open up Notepad. Click on Notepad and search for a line with the text "max_execution_time"
    Screenshot 2024-03-07 074525
  5. It should be equal to 120 by default. Increase the number to a higher value. Make sure to save the file.
    Screenshot 2024-03-07 074652
  6. Now, restart the Apache server (and MySQL if it's not already started) and try installing OrangeHRM. If it still doesn't work, try increasing the timeout to a higher value.

Thank you.. Increasing the "max_execution_time" value to 240 helped in a successful installation.

@devishke-orange
Copy link
Contributor

I'm closing this since the issue was resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5x Issues related to OrangeHRM 5.x versions
Projects
None yet
Development

No branches or pull requests

3 participants