I want to share a few tips from recent experience running upgrades and also how to get to v11 from 9 or 10 easily while importing your data. This is an alternative and works pretty awesome in migrating when simply doing bench update from your current installation; throws you into problems or using bench to restore database into new install is an issue…
I will summarize the steps so that if you need to do this we can then get into details right here on the forum.
- Backup your database and files: the best method is to use sqldump. start at the frappe-bench folder so its easy to locate your database; use .sql as file extension.
- Get your backup out of your server; If you’re on full GUI ubuntu, piece of cake; if you’re on GUI in VM; allow access to copy and paste or drag and drop; or better; allow sftp on port 22 (always available); use Winscp to browse and easily copy files to your local machine. This applies to cloud hosted servers too, WinSCP is an awesome piece of software for easily managing your Ubuntu server instances. Have Putty on hand also.
- Install a clean copy of ERPNext, you will get v11 installed this way; I don’t know if at the time of this writing it has been fixed; but normal updates keep you around v10.
- Copy over your database to your frappe-bench folder; use WinSCP for convenience. If you have an SSH key, use advanced, select the private key and continue. Blissful.
- Restore your database; this is the sweeeeeetest part; the normal restore by bench may fail drastically especially with distant versions. Here’s what to do. if your erpnext db is called erpnextdb (its usually a long alphanumeric name in reality); log into mariadb, don’t use
login to mariadb using
mysql -u root -p database-name;
ensure you start at the folder where you uploaded the database or at least know its location. if you don’t know the erpnext db name, then use
mysql -u root -p mysql;
at the prompt (include the ; ) then see your erpnext db name; now type
Mysql nicely and very quickly imports everything in your backup; replacing tables in your fresh database.
6. Your site will now have Internal Server Error: so yes! all good. Now you need to update so the database is fixed. Type
banch update. If the update tells you there are changes that need to be committed or discarded (you have modifications); then do
bench update --reset (also you can use git stash against the frappe and erpnext folders at the prompt).
Now things begin to update. You will have errors like NULL issues on some tables, some patches will fail; I personally skip them if I look at them and can live without them; others usually are columns issues in tables which you can alter (POST PROBLEMS ON THIS THREAD AND YOU WILL GET HELP because we can’t know which exact tables may give you issues). I had one with apply_user_permission cannot be null, which I solved with this thread
alter table tabDocPerm modify column apply_user_permissions int(1) NULL default 0
I also needed to find the tables with the problem; that’s doable; use the INFORMATION_SCHEMA, as follows:
select * from INFORMATION_SCHEMA.COLUMNS where COLUMN_NAME like '%apply_user_permissions'
On fixing any issue after you have initiated
bench update and it has started progressing; use
bench migrate to continue. For instance, if like me you find something with GST settings that don’t apply here in my country; I opened the patches.txt file, found in apps/frappe/frappe and app/erpnext/erpnext; I commented the line with a #, saved the file and used
to continue exactly from the last patch. not running the update again.
TIP: to know where a patch has failed from; look at the line just before the python error trace and find something like
frappe.patches... then go to the patches.txt file and edit (use WinSCP; its magical as you can edit the files like a simple notepad file and save; winscp updates on server and you push
I hope this helps; let’s discuss any issues and… Here’s a way to easily get on v11 if you have had difficulties.
BUG noticed so far: After the update some items come up with no data at point of sale. Will update if I find a solution.