Foreign Key constraints missing after phpmyadmin export
So the question are: where is my foreign key constraints?
They are defined in the database. The output from SHOW CREATE TABLE users_x_activities
will include the foreign key constraint definitions.
The definitions of the foreign key constraints likely appear in separate ALTER TABLE statements at the end of the generated script.
does KEY refer to FK?
No. KEY id_user (id_user)
here refers to an index.
Seems that the two tables utente and attivita are no longer referenced in the new generated script.
Yes, you are correct. The foreign key constraints are not included in the CREATE TABLE statement.
where am I doing wrong?
A MySQL SHOW CREATE TABLE users_x_activities
will include the foreign key constraints.
The foreign key constraints are likely included in the script generated by phpMyAdmin, but at the end of the script, in separate ALTER TABLE
statements.
There are two type of constraints when you managing your tables with phpmyadmin:
- internal: when you set constraints with phpmyadmin designer for example the constraints stored as internal,that will not be included in export.
- innoDB: these constraints included in export check out linked video about it