0

I have a products module. It's working fine.

I can add, update, delete and list products on the admin of pyrocms.

But now I need to add 4 columns namely for

Available, In Stock, On Hand, Delivered

something like that columns above.

whenever i uninstall my module it always deletes the default_products table.

Hope someone could Help.. Very Much Appreciated

Thanks..

Clannad System
  • 479
  • 3
  • 9
  • 19

3 Answers3

2

You should use the upgrade function into the details.php file. In that function you have to insert all the query to manupulate the table. After the upload of the new module via Control Panel in the Add-on section you will see tha "Upgrade" button that will execute all the alter table query.

function upgrade($old){
//Your alter table query
}
Christian Giupponi
  • 7,408
  • 11
  • 68
  • 113
0

There is some suggestion by my end

  1. Either you can add these fields manual in the database table.
  2. Take a back up of this table and add these fields in the module's detail.php so when you again install these module you can import the data from old table.

Hopefully this will help.

Pramod Kumar Sharma
  • 7,851
  • 5
  • 28
  • 53
  • 1
    oh i never thought of that.. so is it possible to work on 2 pyro? one is the live where i update the columns and details.php and other modules stuff. and another is the development pyro which is tested to install and unistall fine with the 3 new columns. so i just paste the new module files on the productions and then add the columns on the production database. and i wont have to uninstall or re install it right? anyway thats what im going to do / test. Thanks you ALL for the help. – Clannad System May 16 '12 at 15:31
0

Your under-development module would work fine by adding the columns manually to the tables. no further work is needed.

Though you would need to update the detail.php of the module in order to install and uninstall the module.

John
  • 2,461
  • 5
  • 21
  • 18