Databases: Database's change between differents releases

Databases: Database's change between differents releases

John Smith -
回帖数:7

Hi all,

I've searched through the moodle doc without results, so I ask you now,

Does the database change a lot between differents releases?

Because I'm going to set up a system which will run through the Moodle's database, and I'd like to be sure if when Moodle will provide its next release I won't have to re-write my whole system.

I look forward to hearing from you,

Martin

回复John Smith

Re: Databases: Database's change between differents releases

John Smith -

I read this http://docs.moodle.org/dev/Upgrade_API

Maybe I didn't understand everything, but my question is:

Will I use this API to auto increment the change of my system? Basically to change my SQL query in case of the database change a lot between two releases.

Anyone may answer me please?

回复John Smith

Re: Databases: Database's change between differents releases

Itamar Tzadok -

No. The Moodle upgrade API is used by a new release that consists of DB changes to apply the changes to the upgraded Moodle installation.

You can review the release notes and refer to upgrade.php files in relevant components to investigate changes and update your query accordingly. 微笑

回复Itamar Tzadok

Re: Databases: Database's change between differents releases

John Smith -

Ok, thank you.

I have a last question: according to the precedents releases, did the database change a lot? I mean, has the Moodle database known a deep change, which has pushed a lot of users to review their installation?

I'm sorry to insist, but I would like to be definitely fixed.

Thanks 微笑

回复John Smith

Re: Databases: Database's change between differents releases

Tim Hunt -
Core developers的头像 Documentation writers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像

I  would say that the Moodle database evolves with each release. It only evolves as much as is necessary to support the changes that are required, and that varies between releases.

For example, Moodle 1.7 saw the introduction of the new roles and capabilities system, so a number of new tables had to be created (like roles, role_assignments and context) to suppor that, and they replaced some old tables that were dropped (like course_students and course_teachers).

In Moodle 2.1, there were big changes to the question system, so again the tables there like question_sessions and question_states were dropped, and new ones like question_attempts and question_attempt_steps replaced them.

But in those releases, most of the other tables stayed the same.

The other kind of minor change that happes is when a small new feature is added to a particular part of Moodle. For example in Moodle 2.3 there are two new columns in the quiz table: quiz.overduehandling and quiz.graceperiod. But these have sensible defaults, so probably don't break backwards compatibility.

回复Tim Hunt

Re: Databases: Database's change between differents releases

John Smith -

Tim, thank you for the answer!

That was exactly the kind of examples I expected.

Now I am going to take a look to the new feature which are preparing.

My system uses mdl_course, mdl_module, mdl_course_modules and the resources (mdl_resource, mdl_page, ...) so I think it won't be a problem.

Thank you

回复John Smith

Re: Databases: Database's change between differents releases

Tim Hunt -
Core developers的头像 Documentation writers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像

mdl_course, mdl_module, mdl_course_modules are all ancient tables, and it will be very hard to every change them (which explains why the way the work is pretty horrible in some regards). However there have been some new columns added to course_modules like the ones for conditional availability.

mdl_resource, mdl_page last changed significantly in 2.0. It used to be that there was just a single activity resource that did everything and was a mess, so they changed it to have separate activities resource, page, url, etc.