Jump to content

Module development - add upgrade functionnalities


be_tnt

Recommended Posts

Hello,

 

I have developed my own module which is in used on a website. I need to update this module. This update will affect database. Instead of connecting to the database and add manually the missing field, I would like to use an automatic way. I have seen that some module has a button "Update" appearing to the right when a new version is available but those modules are on addons website so I guess this is only for them. Could other custom module use such a method?

 

Any help would be more than welcome.

Link to comment
Share on other sites

the update button exists so that the merchant can automatically download and install the new module to their store. Since I assume your module is not on the addons store, then you cannot use that service to automatically download the module.

 

You can update your module, so that during the construct function, it would check if any updates to the database are required, and then perform those updates. basically for you, you would execute a sql query to check if the table/column already exists, and if it does not exist, then you alter the table to add the missing column.

 

or you can do something more advanced. download the PS paypal module and review the runUpgrades function, that should give you an idea of what you can do.

  • Like 1
Link to comment
Share on other sites

Thx bellini13.

 

I have indeed look into the paypal module to check how they do. The problem I faced was that after the download of the module, the install method was not executed and so I was thinking about uising the reset fonction to install the modification (not good from my point of view). I did not think about using the construct method for this part (did not see first this was done in that way in paypal module).

 

I will try in that way.

 

Thx for your help!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...