Post by Daniel » Thu Jul 23, 2009 1:14 am

I'm trying to work out what is the best way of doing an upgrade script.

I have looked at other scripts like phpbb and I think the problem is that people modifiy opencart more than they would a forum script.

We need a way of reporting chnages to the user before they do an update.

What about the db. Does mysql have functionality to change alter its structure to match another one?

I really don;t want to waste time writing complex upgrade scripts for each release.

Any one have any ideas?

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by Leon » Thu Jul 23, 2009 3:03 am

I'm not sure about the best way to create an upgrade script, but i do know that most of the problems people have when upgrading (in particular to 1.3.0) was because of the database.

Maybe it would be a good idea to have a more advanced backup script where you can specify which tables to keep, and which to not backup. Is it possible to restore a database table without clearing it beforehand?

Maybe then, in the upgrade.txt, you could tell people for example to not backup a certain aspect in the backup manager, so we know not to backup for example the image size section of the settings table, so that when we restore our database using the backup manager, it won't overwrite the image size settings, so we wouldn't get the errors we got when we overwrited the image settings.

I don't even know if this is possible - it's just an idea that could make upgrading have less errors.

Active Member

Posts

Joined
Tue Apr 07, 2009 1:20 am

Post by phpuk » Thu Jul 23, 2009 6:50 am

Hi Daniel,

You can mod mysql tables on the fly if you wish:

Code: Select all

mysql_query("ALTER TABLE orders ADD order_text CHAR(3)");

Code: Select all

mysql_query("ALTER TABLE orders CHANGE order_text order_text VARCHAR(15)");

Code: Select all

mysql_query("ALTER TABLE orders DROP order_text");
Load the fields to do a compare:

Code: Select all

mysql_query("SHOW COLUMNS FROM orders");
You could do a pre install / upgrade check by comparing the files one by one and writing out a text file of the changes / differences so people can do the mods etc...

Hope this helps...

Phil.

Global Moderator

Posts

Joined
Wed Mar 25, 2009 10:57 am

Post by lillolollo » Thu Jul 23, 2009 11:52 am

Daniel take a look at phorum.org code they use "hooks" whit hooks you can add more and more module but core code is still intact so you can upgrade whit no truble also take a look at upgrade script version 3 to 5

New member

Posts

Joined
Wed May 13, 2009 11:12 am

Post by Truemedia » Fri Jul 24, 2009 9:18 pm

Wordpress uses a system that automatically updates itself by creating the files it needs (php pages creating php pages) and phpbb although it does not do it automatically has a very good system.

I'm sure an update system similarr to phpbb could be accomplished, lots of people know how to modify the core phpbb from how it works and create modifications around the existing system. Maybe you could get people from the phpbb community to help you replicate that?

Newbie

Posts

Joined
Wed Jul 15, 2009 5:38 am

Post by JNeuhoff » Fri Jul 24, 2009 11:38 pm

MySQL provides the 'DESCRIBE table-name' statement for retrieving all the information of a table, including stuff like the Field, Type, Null, Key, Default, Extra. Do this for both the old and new version of the database table, compare the 2 result sets, and if the old table has any additional fields added by the store owner or by a contribution, it will detect it. You can then use the normal ALTER TABLE statement for the new table to insert the additional field columns.

In fact it should be possible to provide a fairly generic SQL upgrade script with this. Just make sure you haven't renamed field columns between the old and new version of a DB table.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member
Online

Posts

Joined
Wed Dec 05, 2007 3:38 am

Who is online

Users browsing this forum: No registered users and 4 guests