Quantcast
Channel: Active questions tagged referential-integrity - Database Administrators Stack Exchange
Viewing all articles
Browse latest Browse all 60

How can I change the REFERENCE in a FOREIGN KEY?

$
0
0

After renaming some tables I get the following error:

MariaDB [testdb]> INSERT INTO user_events (date, uid, operation, info) VALUES('2022-09-15','xyz','create',NULL);ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails `testdb`.`user_events`, CONSTRAINT `user_events_ibfk_1` FOREIGN KEY (`uid`) REFERENCES `associations` (`uid`))

The reason is that the table associations in REFERENCES needs to be changed to users.

What is the easiest way of achieving this?


Viewing all articles
Browse latest Browse all 60

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>