You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've tried to add an asset or a login-passport , I got this⬇️. But when I added the 1st asset, it did successfully.
I stopped the other mysql. The only running mysql is oneterm-mysql container.
This error is indicating that when you're trying to insert a record into the acl_role_permissions table, the value for rid (role ID) is set to 0, which doesn’t exist in the acl_roles table. In other words, the foreign key constraint is being violated because you're referencing a role that hasn't been created.
Here are a few steps to resolve the issue:
Verify the Role Exists:
Check the acl_roles table to see if there is a record with id = 0. Most systems start IDs at 1, so it's likely that no role with id = 0 exists.
Update the Insert Data:
If 0 is not a valid role ID, update your code to use a valid role ID that already exists in acl_roles or create the necessary role entry if that's what’s expected.
Review Your Data Flow:
Ensure that the process which assigns or passes the role ID (rid) is functioning as intended. There might be a misconfiguration or a bug that sets rid to 0 inadvertently.
Check Default Values or Migrations:
If your application expects a default role, ensure that the default record is properly inserted into the acl_roles table during the setup or migration process.
By following these steps, you should be able to resolve the foreign key constraint error and proceed with adding your asset or login-passport functionality.
Contact Details
No response
What is your question?
I've tried to add an asset or a login-passport , I got this⬇️. But when I added the 1st asset, it did successfully.
I stopped the other mysql. The only running mysql is oneterm-mysql container.
服务错误: (pymysql.err.IntegrityError) (1452, 'Cannot add or update a child row: a foreign key constraint fails (
acl
.acl_role_permissions
, CONSTRAINTacl_role_permissions_ibfk_1
FOREIGN KEY (rid
) REFERENCESacl_roles
(id
))') [SQL: INSERT INTO acl_role_permissions (deleted_at, deleted, created_at, updated_at, rid, resource_id, group_id, perm_id, app_id) VALUES (%(deleted_at)s, %(deleted)s, %(created_at)s, %(updated_at)s, %(rid)s, %(resource_id)s, %(group_id)s, %(perm_id)s, %(app_id)s)] [parameters: {'deleted_at': None, 'deleted': 0, 'created_at': datetime.datetime(2025, 2, 20, 4, 46, 8, 891969), 'updated_at': None, 'rid': 0, 'resource_id': 36, 'group_id': None, 'perm_id': 8, 'app_id': 4}] (Background on this error at: https://sqlalche.me/e/14/gkpj)Version
newest
The text was updated successfully, but these errors were encountered: