Foreign Keys - Reloaded

Foreign Keys - Reloaded

Asaf Ohaion -
Vastausten määrä: 7
Hello

I've started this issue again
I think its really important ,
and so:
enabled $foreign_keys
in lib/ddl/sql_generator


tried fresh install, it fails

tables should be ordered by dependencies,

I've reordered in lib/db/install.xml


tables are created OK, other issues start to show up

I want to work on this systematically,

what is the correct way to do so and have my code integraded to moodle.org

?


10x


attaching first patch (reorder core tables creation)

done against 2.7.1


Arviointien keskiarvo: -
Vastaus Asaf Ohaion

Re: Foreign Keys - Reloaded

Richard Oelmann -
Kuva: Core developers Kuva: Particularly helpful Moodlers Kuva: Plugin developers Kuva: Testers

You say

"I've started this issue again
I think its really important"

Please can you say where the "again" is from - a link to previous discussions or tracker issues

And why you consider it to be important, please.

If this is an improvement to the way Moodle's database is structured I would imagin the best next step would be for you to create a tracker issue for it and identify there the why's and how's involved.

Vastaus Richard Oelmann

Re: Foreign Keys - Reloaded

Marcus Green -
Kuva: Core developers Kuva: Particularly helpful Moodlers Kuva: Plugin developers Kuva: Testers

I used my Google Fu to discover this

https://moodle.org/mod/forum/discuss.php?d=192575

It's about Foreign Key relationships. I think that it should be possible to install Moodle with foreign keys turned on. At minimum it would make it easier for developers to work out the relationships between tables.


(I am moving towards Duck Duck Fu but it doesn't scan as well)

Vastaus Richard Oelmann

תשובה ל: Re: Foreign Keys - Reloaded

Asaf Ohaion -

I think the importance should be obvious - referential integrity

Vastaus Asaf Ohaion

Re: Foreign Keys - Reloaded

Tomasz Muras -
Kuva: Core developers Kuva: Plugin developers Kuva: Plugins guardians Kuva: Translators
You should create an issue on tracker.moodle.org . When you do, put link to it here, I'm ddefinitely going to vote for it - I also think it's important to at least make it possible to turn on foreign keys support in DB.

cheers,
Tomek
Arviointien keskiarvo:Useful (1)
Vastaus Tomasz Muras

Re: Foreign Keys - Reloaded

Dan Marsden -
Kuva: Core developers Kuva: Particularly helpful Moodlers Kuva: Peer reviewers Kuva: Plugin developers Kuva: Plugins guardians Kuva: Testers Kuva: Translators

we already have a tracker issue related to foreign key support - please see: MDL-30799

There are some linked issues that need to be resolved - and it's likely there are other issues that need to be resolved before we can turn them on.

Arviointien keskiarvo:Useful (1)
Vastaus Dan Marsden

Re: Foreign Keys - Reloaded

Séverin Terrier -
Kuva: Documentation writers Kuva: Particularly helpful Moodlers Kuva: Testers Kuva: Translators

I also think that foreign key support would be a good thing.

At least it should be on for new Moodle sites.

But for old sites, there should absolutly need solutions to repair all problems that can exist in DB!

In my university, we've started using Moodle with version 1.5, and updated by several 1.5.x, 1.6.x, 1.8.x, 1.9.x. Then we've set up a new 2.4 (updated to 2.7), but as we've restored content from 1.9, we still have several problems in the DB. And there are also several problems shown via /moodle/admin/tool/health/

And even a Moodle started in 2.1 (updated to 2.3, 2.5 and 2.7) has problems shown via XMLDB editor checkups.

Séverin

Vastaus Asaf Ohaion

תשובה ל: Foreign Keys - Reloaded

Avi Levy -
Kuva: Core developers Kuva: Plugin developers Kuva: Testers

Hi,

I was comment on the ticket and add link to my repo in github, I was able to install the moodle with foriegn key enabled, but we need to check if its Ok, that all action was done by the admin user and also I was need to change sthe session manager. I don't know if there is any secuerty issue with this fix, we need to test it.

https://tracker.moodle.org/browse/MDL-30799