![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/Ecombricks/InventoryInventoryCatalogPrice/Setup/ |
<?php /** * Copyright © eComBricks. All rights reserved. * See LICENSE.txt for license details. */ declare(strict_types=1); namespace Ecombricks\InventoryInventoryCatalogPrice\Setup; /** * Install schema */ class InstallSchema extends \Ecombricks\InventoryInventoryCatalog\Setup\AbstractSourceItemOptionInstallSchema { /** * Constructor * * @param \Ecombricks\InventoryInventoryCatalogPrice\Model\SourceItemPrice\Label $sourceItemOptionLabel * @param string $tableName * @return void */ public function __construct( \Ecombricks\InventoryInventoryCatalogPrice\Model\SourceItemPrice\Label $sourceItemOptionLabel, string $tableName = 'ecombricks_source_item_price' ) { parent::__construct( $sourceItemOptionLabel, $tableName ); } /** * Get value column * * @return array */ protected function getValueColumn(): array { return [ 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, 'length' => null, 'options' => [ 'precision' => 12, 'scale' => 4, 'unsigned' => false, ], ]; } /** * Create product index price source table * * @param string $tableName * @param string $tableComment * @return $this */ protected function createProductIndexPriceSourceTable(string $tableName, string $tableComment) { $table = $this->getConnection() ->newTable($this->getTable($tableName)) ->setComment($tableComment); $this ->addTableColumn($table, [ 'name' => 'entity_id', 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 'options' => [ 'primary' => true, 'unsigned' => true, 'nullable' => false, ], 'comment' => 'Entity ID', ]) ->addTableColumn($table, [ 'name' => 'website_id', 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, 'options' => [ 'primary' => true, 'unsigned' => true, 'nullable' => false, ], 'comment' => 'Website ID', ]) ->addTableColumn($table, [ 'name' => 'min_price', 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, 'options' => [ 'precision' => 12, 'scale' => 4, 'unsigned' => false, 'nullable' => true, ], 'comment' => 'Min Price', ]) ->addTableColumn($table, [ 'name' => 'max_price', 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, 'options' => [ 'precision' => 12, 'scale' => 4, 'unsigned' => false, 'nullable' => true, ], 'comment' => 'Max Price', ]) ->createTable($table); return $this; } /** * Execute * * @return $this */ protected function execute() { parent::execute(); $this->createProductIndexPriceSourceTable( 'ecombricks_catalog_product_index_price_source_idx', 'Product Index Price Source Index' ); $this->createProductIndexPriceSourceTable( 'ecombricks_catalog_product_index_price_source_tmp', 'Product Index Price Source Temp' ); return $this; } }