Creating an upgrade schema script (UpgradeSchema.php)

During the first-time module install, an upgrade schema is what gets run immediately after an install schema. We define upgrade schema within the app/code/Foggyline/Office/Setup/UpgradeSchema.php file with (partial) content as follows:

namespace Foggyline\Office\Setup;

use Magento\Framework\Setup\UpgradeSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;

class UpgradeSchema implements UpgradeSchemaInterface
{
    public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
    {
        $setup->startSetup();
          /* #snippet1 */
        $setup->endSetup();
    }
}

UpgradeSchema conforms to UpgradeSchemaInterface, which requires the implementation ...

Get Magento 2 Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.