How to manually test an add-on package upgrade?

Permalink
Can anyone tell me how I can manually test the upgrade process for a C5v8 add-on I am developing?
It would actually be very helpful to be able to do manual updates during development.
I have made some additions to db.xml and would like the database to automatically get updated by adding the new fields while retaining the current data.
Do I just update the package version number in the package controller.php and then copy the new package on top of the old installation?
Does this code need to also be added to the package controller.php?
public function upgrade() {
    parent::upgrade();
    $pkg = Package::getByHandle('custom_theme');
    $bt = BlockType::getByHandle('custom_block_type');
    if (!is_object($bt)) {
        $bt = BlockType::installBlockTypeFromPackage('custom_block_type', $pkg);
    }
}

Code from:https://documentation.concrete5.org/developers/packages/handling-pac...
Since I am only installing an add-on how does the line with $pkg apply? And what is 'custom_theme' for an add-on?
Is the 'custom_block_type' the name I assigned to $pkgHandle?

jfhencken
 
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi jfhencken,

I believe that incrementing the package version will trigger an add-on update notification. When you update the add-on the block is refreshed, which includes updating the table columns.
JohntheFish replied on at Permalink Reply
JohntheFish
A trick I have used while developing is to append the time to the package version in the __construct() method.

// works for c5.6.x
public function __construct(){
  $this->pkgVersion = $this->pkgVersion.'.'.time();
}

This was trivial to implement in 5.6, but refactoring of the package controller base class in 5.7 and 5.8 makes the added complexity hardly worthwhile so I have gone back to editing the version manually as @MrKD has noted.