I wan’t to add data in a custom field that I created, I used InstallSchema like this:
Setup/InstallSchema.php
use MagentoFrameworkSetupInstallSchemaInterface;
use MagentoFrameworkSetupSchemaSetupInterface;
use MagentoFrameworkSetupModuleContextInterface;
class InstallSchema implements InstallSchemaInterface
{
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$installer = $setup;
$installer->startSetup();
$installer->getConnection()->addColumn(
$installer->getTable('quote'),
'pakke_shipmentid',
[
'type' => 'text',
'nullable' => true,
'comment' => 'Pakke Shipment Id',
]
);
$installer->getConnection()->addColumn(
$installer->getTable('sales_order'),
'pakke_shipmentid',
[
'type' => 'text',
'nullable' => true,
'comment' => 'Pakke Shipment Id',
]
);
$installer->getConnection()->addColumn(
$installer->getTable('sales_order_grid'),
'pakke_shipmentid',
[
'type' => 'text',
'nullable' => true,
'comment' => 'Pakke Shipment Id',
]
);
$setup->endSetup();
}
}
I will need to use it in observer.
Greetings!