Although there’s no documentation stating this, based on system behavior it seems like the
Package/Module/Setup/InstallSchema.php
class files are sort of required by a Magento module.
I say sort of required because you can run a module without them. You can use that module to add features to Magento. However, a version number for that module will not be added to the setup_module
table unless the InstallSchema class is present.
I discovered this when I tried adding an UpgradeSchema
class to a module that didn’t have an InstallSchema
. The UpgradeSchema
still ran, but calling $context->getVersion()
public function upgrade(
SchemaSetupInterface $setup,
ModuleContextInterface $context
)
{
$setup->startSetup();
$version = '[' . $context->getVersion() . ']';
file_put_contents('/tmp/schema.log',$version . "n",FILE_APPEND);
$setup->endSetup();
}
returned an empty string, as there were no entries for my module in the setup_module
table.