XF 2.2 Upgrade step did not run on fresh install

asprin

Active member
Hello all,

I recently finished packing an addon which has had 3 versions so far:
  1. 1000030
  2. 1000130
  3. 1010030

The Setup.php file contains the following steps
PHP:
public function installStep1()
{
    $this->schemaManager()->createTable('xf_asp_fb_foo', function(\XF\Db\Schema\Create $table)
    {
        $table->checkExists(true);
        $table->addColumn('sys_id', 'int')->autoIncrement();
        $table->addColumn('title', 'varchar', 40);
        $table->addPrimaryKey('sys_id');
    });
}

public function upgrade1000130Step1()
{
    $this->schemaManager()->alterTable('xf_asp_fb_foo', function(Alter $table)
    {          
        $table->addColumn('description', 'varchar', 255);
    });
}

When I attempted to freshly install the addon (after using the release on the final version), I noticed that the installation was successful but the upgrade1000130Step1 did not run. ACP reports the correct final version of 1010030, so there's no "upgrade" option available in the ACP as well.

Am I doing anything wrong in the setup file?
 
Last edited:
Solution
Install steps run at install time. Upgrade steps run at upgrade time. An install will not run upgrade steps.

Your install step needs to include the table being created with the description column. The upgrade steps exist for people who already have the add-on installed and upgrading from an earlier version.
Install steps run at install time. Upgrade steps run at upgrade time. An install will not run upgrade steps.

Your install step needs to include the table being created with the description column. The upgrade steps exist for people who already have the add-on installed and upgrading from an earlier version.
 
Solution
Top Bottom