Hi Fasse, all.
So, our team has added the Menu module that is new with the recent release.
However, dueto the volume of customizations we have put in place, simply
checking out and merging the newest version proved very problematic for us.
Accordingly, we decided to reproduce the Menu module manually
We are close, but are getting the following error when trying to set permissions
under "visible for" in Edit Menu mode:
S Q L - E R R O R
CODE: 23000
1452
Cannot add or update a child row: a foreign key constraint fails ("admidio_dev"."adm_roles_rights_data", CONSTRAINT "adm_FK_RRD_ROR" FOREIGN KEY ("rrd_ror_id") REFERENCES "adm_roles_rights" ("ror_id"))
B A C K T R A C E
FILE: adm_program/system/classes/database.php
LINE: 514
CALL: Database->showError()
FILE: adm_program/system/classes/tableaccess.php
LINE: 545
CALL: Database->query()
FILE: adm_program/system/classes/rolesrights.php
LINE: 68
CALL: TableAccess->save()
FILE: adm_program/modules/menu/menu_function.php
LINE: 109
CALL: RolesRights->addRoles()
Here are the table structures:
MariaDB [admidio_dev]> select * from adm_roles_rights;
+--------+-----------------+-------------+
| ror_id | ror_name_intern | ror_table |
+--------+-----------------+-------------+
| 1 | folder_view | adm_folders |
| 2 | folder_upload | adm_folders |
+--------+-----------------+-------------+
2 rows in set (0.00 sec)
MariaDB [admidio_dev]> select * from adm_roles_rights_data;
+--------+------------+------------+---------------+-------------------+----------------------+
| rrd_id | rrd_ror_id | rrd_rol_id | rrd_object_id | rrd_usr_id_create | rrd_timestamp_create |
+--------+------------+------------+---------------+-------------------+----------------------+
| 1 | 1 | 8 | 2 | 2 | 2018-04-15 00:43:19 |
| 2 | 1 | 8 | 1 | 2 | 2018-04-15 00:43:19 |
| 3 | 2 | 8 | 2 | 2 | 2018-04-15 00:43:19 |
| 4 | 2 | 8 | 1 | 2 | 2018-04-15 00:43:19 |
+--------+------------+------------+---------------+-------------------+----------------------+
4 rows in set (0.00 sec)
And here is the insert statement that seems to be firing when the FK constraint is violated:
INSERT INTO adm_roles_rights_data ( rrd_rol_id , rrd_object_id , rrd_usr_id_create , rrd_timestamp_create ) VALUES ( 8 , 6 , 2 , '2018-09-04 11:40:21' ) ;
It seems to me that the problem is that the ror_table "adm_lists" is not in adm_roles_rights and therefore the FK constraint
fails when inserting into adm_roles_rights_data.
My question is - how are rows getting populated into adm_roles_rights? Is this something that I have to do manually - with an insert script of some sort? Maybe we are missing something that got included with the recent update (I looked but didn't find a new script)?
Thanks again for all the help.
Peter
a foreign key constraint fails
Re: a foreign key constraint fails
Do you have perform the Update steps from Version 3.2 to version 3.3?
Re: a foreign key constraint fails
Just figured it out. Sorry, premature post