-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Database (MySQL): Missing constraints/foreign keys #10014
Comments
Sample: MariaDB [owncloud]> ALTER TABLE oc_group_user ADD FOREIGN KEY (uid) REFERENCES oc_users(uid); |
Another one: MariaDB [owncloud]> ALTER TABLE oc_group_admin ADD FOREIGN KEY(uid) REFERENCES oc_users(uid); |
It looks like these columns are candidats for foreign keys, is it possible to use always the same column-name? +-------------------+------------------+-------------+ I think they all belong (reference) to oc_users::uid, right? |
Thanks a lot for looking into this. ownCloud's database migration mechanism does not support foreign keys at the moment. |
Can you please gibt me the corresponding issue-numbers? |
For now this can only be closed as 'Won't fix'. @karlitschek please reconsider this. Foreign keys are important for DB integrity. Vic already linked to the other issue where we discussed this in more detail. If you want me to write a paper on 'why foreign keys are important', just tell me. |
I just looked at the data model and tables and I wondered why there are foreign keys missing, e.g.
CREATE TABLE
oc_group_user
(gid
varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',uid
varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',PRIMARY KEY (
gid
,uid
)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin
I think there MUST be two foreign keys, one to oc_groups and one to oc_users.
But I see that there is NO foreign key in whole data model.
I want to tell you to change this.
The text was updated successfully, but these errors were encountered: