1
intel352
Updating a module, how to modify SQL database?
  • 2004/5/23 23:23

  • intel352

  • Module Developer

  • Posts: 824

  • Since: 2003/11/23


Okay, I'm working on revising some of the SQL layout for the Donations module that I announced here

I don't want users to have to uninstall/reinstall the module the module for the sql changes to take place. What I need to know is, does XOOPS keep track of table structure, and if it finds a different structure on a module that is being Updated, does it apply those changes?

If not, what would be the best method to achieve this? I will be changing a field-type in 1 table, and adding 4 new field onto another table.

Any help is appreciated

2
intel352
Re: Updating a module, how to modify SQL database?
  • 2004/5/24 12:52

  • intel352

  • Module Developer

  • Posts: 824

  • Since: 2003/11/23


bump...

'anyone? anyone? bueller?'

3
Mithrandir
Re: Updating a module, how to modify SQL database?

Xoops does not have a database table update in a module updating.

What you can do as a module developer is to make a little php file, which can be executed manually by the user and will run the required SQL statements.

4
intel352
Re: Updating a module, how to modify SQL database?
  • 2004/5/24 13:14

  • intel352

  • Module Developer

  • Posts: 824

  • Since: 2003/11/23


thx mith, wasn't sure, didn't want to create an upgrade file if a solution already existed

okay, i'd like to file this as a feature request then, lol, maybe a function that tells what 'upgrade' sql to execute based on original version and new version...

5
Herko
Re: Updating a module, how to modify SQL database?
  • 2004/5/24 13:27

  • Herko

  • XOOPS is my life!

  • Posts: 4238

  • Since: 2002/2/4 1


Isn't this already possible? There is an onInstall or onUpgrade event, right? One that triggers the custom made upgrade script (add a check to see if it is nessecary to upgrade or not in the upgrade script). That should fix it?

Herko (again, non dev)

6
intel352
Re: Updating a module, how to modify SQL database?
  • 2004/5/24 13:41

  • intel352

  • Module Developer

  • Posts: 824

  • Since: 2003/11/23


ah, excellent, i'll have to find that function to see how i can use it

thanks herko

7
Mithrandir
Re: Updating a module, how to modify SQL database?

OnInstall and OnUninstall is there - no OnUpgrade afaik. Shouldn't be too hard to implement though, with a function being called with the module version as parameter. Then the function can have a
switch ($version) {
     case 
200//upgrading from version 2.00
     //perform upgrading things
     
break;

     case 
220//upgrading from version 2.20
     //perform other upgrading stuff
     
break;

     case 
240//let's say that is current version
     
$msg[] = "current version, no action";
     break;
}

8
intel352
Re: Updating a module, how to modify SQL database?
  • 2004/5/24 13:59

  • intel352

  • Module Developer

  • Posts: 824

  • Since: 2003/11/23


are you suggesting that routine for XOOPS implementation or my own implementation?

if you're referring that code to me, then what would be the best method to grab the user's currently installed version to determine the upgrade path?

i'd prefer to handle this somewhere in xoops_version, but i'm not sure how possible that would be since there's no onUpgrade function

9
Mithrandir
Re: Updating a module, how to modify SQL database?

it was mainly for a XOOPS implementation.

Login

Who's Online

215 user(s) are online (146 user(s) are browsing Support Forums)


Members: 0


Guests: 215


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits