General developer forum

Migrate DB from 2.5 to 3.4

 
Picture of Hossein Poursaeedi
Migrate DB from 2.5 to 3.4
 

Guys,

I need to migrate my DB from Version 2.5 to 3.4.

and i have some question.
1- do we need to migrate which tables ?

2- do i need to modify any tables?

3- is there any tools to do it ?


thanks

 
Average of ratings: -
Davo
Re: Migrate DB from 2.5 to 3.4
Core developersParticularly helpful MoodlersPlugin developers

Read the Moodle upgrading docs: https://docs.moodle.org/34/en/Upgrading (but note the need to upgrade to Moodle 3.0, before Moodle 3.4).

 
Average of ratings: Useful (1)
Picture of Hossein Poursaeedi
Re: Migrate DB from 2.5 to 3.4
 

Thanks for your reply,
but in upgrading , we try by git or script to upgrade moodle itself , even if we do manually we usually try  mysqldump and then other process , 

currently i have customized  3.4 version of moodle in different server, and only want to migrate data into db, if i dump new db , i will loose new customized feature , thats why i need difference between 2 dbs.


thanks

 
Average of ratings: -
Davo
Re: Migrate DB from 2.5 to 3.4
Core developersParticularly helpful MoodlersPlugin developers

I would guess that there are hundreds of database changes between Moodle 2.5 and 3.4 (and that's just counting table definitions, not including and data transitions that take place).

If you want to see the differences, then there is a perfectly good tool designed for doing that - it is the Moodle upgrade process. Copy your database, upgrade it, then compare with the original.

If you have already configured your 3.4 site, then the only real way to merge the sites together would be to backup each of the courses from the old site and restore them to the new site. If the old site has a lot of courses and your new site has only configuration, then it will be quicker to just upgrade, then redo the configuration afterwards.

 
Average of ratings: Useful (1)
Picture of Hossein Poursaeedi
Re: Migrate DB from 2.5 to 3.4
 

Thanks Davo,

As i understand, there is no script to mapping only data Base from old version to new version.
ill try to do upgrading , and hope wont get issue with customized libs.
may i ask , upgrading will map data to new db schema or will merge with it (new version) if you know?
thanks alot

 
Average of ratings: -
Picture of Mark Sharp
Re: Migrate DB from 2.5 to 3.4
Core developersParticularly helpful MoodlersPlugin developers

Test test test.

We migrated from 1.9 to 2.6, which really was a big leap. We had a heavily customised 1.9 where we had changed core tables, and messed with core code.

It took me some months to unpick the mess and find ways of doing things that didn't require core changes. I had to create new plugins and add lots of renderer overrides to achieve it. The goal must be to leave your new Moodle in a position that makes it easy to upgrade going forward. Otherwise, in the future, you'll find yourself in the same position you're in now.

By the time we did our migration, I had already tested the full process on dev servers 3 or 4 times, so knew exactly what to expect. So test test test.

ps. At the beginning of our process, I was looking at manually migrating the database. But that was a waste of time. I found myself copying code from upgrade.php files. Just go the Moodle way.

 
Average of ratings: Useful (1)
Picture of Hossein Poursaeedi
Re: Migrate DB from 2.5 to 3.4
 
Thanks for your reply Mark,
Same issue , should revamp some older styled code. ill try to follow moodle way, but  moodle also ask to upgrade twice.

first to version 3 then 3.4, if im in right trunk .
is there any way which directly upgrade from 2.5 to 3.4 ?

 
Average of ratings: -
Davo
Re: Migrate DB from 2.5 to 3.4
Core developersParticularly helpful MoodlersPlugin developers

No - you cannot go directly from 2.5 to 3.4.

However, there is usually no problem going from a customised 2.5 to a clean 3.0 to a customised 3.4 (as long as you ignore a few 'missing plugin' warnings during the 3.0 upgrade part). I've done this a number of times (but it does depend on exactly what you have customised).


 
Average of ratings: -
Picture of Mark Sharp
Re: Migrate DB from 2.5 to 3.4
Core developersParticularly helpful MoodlersPlugin developers

When we upgraded from 1.9 to 2.6 we had to go via 2.2. This is so that Moodle can keep the upgrade scripts to a sensible level of detail. If you look at /lib/db/upgrade.php (https://github.com/moodle/moodle/blob/091b2fad148199f24caa551ed3425697397f2e23/lib/db/upgrade.php#L94) for 3.4, you'll see that it requires you to upgrade 3.0 first. If look at the same line in 3.0 you can upgrade from 2.2 to 3.0.

 
Average of ratings: -
Picture of Hossein Poursaeedi
Re: Migrate DB from 2.5 to 3.4
 

Thanks guys, everything seems ok, only need to check if plugins data still there after upgrading , hope it wont overriding during new installation (as moodle ask to install new version of plugin instead of update).

beside that , may i know these "to be deleted" sign needs to delete manually from db??


 
Average of ratings: -