Skip to main content


DBStructure update


!Friendica Support Sorry if this has been addressed already and I missed it in my search. I may have been a version or two behind before getting the latest in the past few days, however, I'm getting an error and set into maintenance mode.

bin/console dbstructure update produces the following:
[Error] SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`social`.`item`, CONSTRAINT `item_ibfk_4` FOREIGN KEY (`psid`) REFERENCES `permissionset` (`id`))

I am able to turn off maintenance mode and seem to use without errors.

Anyone have ideas or suggestions?

Friendica Support reshared this.

Ok, made my backup. Ran the command to see which tables came up:
These tables are not used for friendica and will be deleted when you execute "dbstructure drop -e":

auth_codes
ffinder
item-activity
participation
item-content
poll_result
term
profile_check
fserver
poll
clients
dsprphotoq
gcontact
item-delivery-data
challenge
item
gcign
thread
gfollower
host
deliverq
tokens
item_id
queue
sign
glink
spam
user-item


Fingers crossed...
Well, that didn't go well. Ran command with '-e' and received:
[Error] SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails
DROP TABLE `auth_codes`;
DROP TABLE `ffinder`;
DROP TABLE `item-activity`;
DROP TABLE `participation`;
DROP TABLE `item-content`;
DROP TABLE `poll_result`;
DROP TABLE `term`;
DROP TABLE `profile_check`;
DROP TABLE `fserver`;
DROP TABLE `poll`;
DROP TABLE `clients`;


Then, for fun, tried to run dbscructure update, which gave:
[Error] SQLSTATE[HY000]: General error: 1356 View 'social.participation-view' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
@Michael Vogel Will do. Will update with results when I can.
@Michael Vogel looks like it's the clients table

MariaDB [social]> DROP TABLE `clients`;
ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails
more detail. clients has FK to tokens table. Dropping tokens first allows clients to be dropped. Now, the item table is giving error, and upon inspection the table has several constraints, on the order of 10, to several tables. This table also contains some 27 thousand rows.
I had just cleared up the tokens and client table, then tried using the console again to "do the rest". I can/will manually drop the other tables on the list, and see if the items table still complains
I manually dropped the other tables, then ran the drop -e command when only the 'items' table was left. It was finally successful. Now the bin/console dbstructure drop command gives no table names. I then ran dbstructure update, and received this error:
[Error] SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`social`.`post-thread-user`, CONSTRAINT `post-thread-user_ibfk_7` FOREIGN KEY (`psid`) REFERENCES `permissionset` (`id`))
@Michael Vogel commented out the line and then successfully completed the dbstructure update. Things are looking well!!! Thank you very much for your patience and help, as always!!