Skip to content
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

Foreign keys violations. #331

Closed
ewallah opened this issue Feb 29, 2020 · 2 comments
Closed

Foreign keys violations. #331

ewallah opened this issue Feb 29, 2020 · 2 comments
Assignees
Labels

Comments

@ewallah
Copy link
Contributor

ewallah commented Feb 29, 2020

2 foreign keys on tables customcert and table customcert_pages point to a non-existent table customcert_template. Both keys should point to customcert_templates. The missing letter surely affects performance, but is probably also the cause for other unwanted behaviour.

To check: visit admin/tool/xmldb and opt for the last option [check foreign keys]

- Foreign key template on table customcert points to a non-existent table customcert_template.
- Foreign key template on table customcert_pages points to a non-existent table customcert_template.

To fix in new installs: edit db/install,xml

-<KEY NAME="template" TYPE="foreign" FIELDS="templateid" REFTABLE="customcert_template" REFFIELDS="id"/>
+<KEY NAME="template" TYPE="foreign" FIELDS="templateid" REFTABLE="customcert_templates" REFFIELDS="id"/>

- <KEY NAME="template" TYPE="foreign" FIELDS="templateid" REFTABLE="customcert_template" REFFIELDS="id"/>
+ <KEY NAME="template" TYPE="foreign" FIELDS="templateid" REFTABLE="customcert_templates" REFFIELDS="id"/>

Current users will need an upgrade script so these changes get into the database.

@mdjnelson mdjnelson added the bug label Mar 9, 2020
mdjnelson added a commit that referenced this issue Mar 9, 2020
mdjnelson added a commit that referenced this issue Mar 9, 2020
@mdjnelson
Copy link
Owner

Fixed. Thanks. However, Moodle does not respect foreign keys and simply adds an index due to some historical reason where some or one database didnt support it. However, best to fix it now before it causes an issue later.

mdjnelson added a commit that referenced this issue Mar 9, 2020
mdjnelson added a commit that referenced this issue Mar 9, 2020
mdjnelson added a commit that referenced this issue Mar 9, 2020
@ewallah
Copy link
Contributor Author

ewallah commented Mar 9, 2020

THX for the quick response!

mdjnelson added a commit that referenced this issue Mar 9, 2020
@mdjnelson mdjnelson self-assigned this Mar 9, 2020
mdjnelson added a commit that referenced this issue Mar 9, 2020
mdjnelson added a commit that referenced this issue Mar 9, 2020
mdjnelson added a commit that referenced this issue Mar 9, 2020
mdjnelson added a commit that referenced this issue Apr 17, 2020
mdjnelson added a commit that referenced this issue Apr 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants