Upgrade table "prxgt_wallet_partial_quote". Add currencies fields.

@param \Magento\Framework\Setup\SchemaSetupInterface $setup
334888
private function upgradeTblQuote($setup)
    {
        $conn = $setup->getConnection();
        $table = $setup->getTable(EPartQuote::ENTITY_NAME);

        /* add columns */
        $conn->addColumn(
            $table,
            EPartQuote::A_BASE_CURRENCY,
            [
                'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
                'length' => 3,
                'nullable' => false,
                'after' => EPartQuote::A_BASE_PARTIAL_AMOUNT,
                'comment' => 'Currency code for base amount (stock/warehouse currency).'
            ]
        );
        $conn->addColumn(
            $table,
            EPartQuote::A_CURRENCY,
            [
                'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
                'length' => 3,
                'nullable' => false,
                'after' => EPartQuote::A_PARTIAL_AMOUNT,
                'comment' => 'Currency code for amount (payment??? currency).'
            ]
        );
    }
463154
protected function addCurrency()
    {
        $this->controlAccess('currency_add');

        if ($this->currency->add($this->getSubmitted())) {
            $this->redirect('admin/settings/currency', $this->text('Currency has been added'), 'success');
        }

        $this->redirect('', $this->text('Currency has not been added'), 'warning');
    }
816351
public function upgrade(
        SchemaSetupInterface $setup,
        ModuleContextInterface $context
    ) {
        $setup->startSetup();

        if (version_compare($context->getVersion(), '1.1.0', '<')) {
            $this->catalogSetup->appendDecimalDisplayConfiguration($setup);
        }

        if (version_compare($context->getVersion(), '1.2.2', '<')) {
            $this->catalogSetup->removeIsUsedInAutocompleteField($setup);
        }

        if (version_compare($context->getVersion(), '1.3.0', '<')) {
            $this->catalogSetup->createCategoryFacetConfigurationTable($setup);
        }

        if (version_compare($context->getVersion(), '1.4.0', '<')) {
            $this->catalogSetup->createSearchPositionTable($setup);
        }

        if (version_compare($context->getVersion(), '1.5.0', '<')) {
            $this->catalogSetup->addBlacklistColumnToSearchPositionTable($setup);
            $this->catalogSetup->setNullablePositionColumn($setup);
        }

        if (version_compare($context->getVersion(), '1.5.1', '<')) {
            $this->catalogSetup->addSortOrderMissingFields($setup);
        }

        $setup->endSetup();
    }
1123362
public function removeIsUsedInAutocompleteField(SchemaSetupInterface $setup)
    {
        $connection = $setup->getConnection();
        $table      = $setup->getTable('catalog_eav_attribute');

        $connection->dropColumn($table, 'is_used_in_autocomplete');
    }
1162885
private function upgradeExternalLinks($addScheme)
    {
        foreach ($this->localizationManager->getLocalizations() as $localization) {
            $rows = $this->session->getWorkspace()->getQueryManager()->createQuery(
                sprintf(
                    'SELECT * FROM [nt:unstructured] WHERE [%s] = "%s"',
                    $this->propertyEncoder->localizedSystemName('nodeType', $localization->getLocale()),
                    RedirectType::EXTERNAL
                ),
                'JCR-SQL2'
            )->execute();

            $name = $this->propertyEncoder->localizedSystemName('external', $localization->getLocale());
            foreach ($rows->getNodes() as $node) {
                /** @var NodeInterface $node */
                $value = $node->getPropertyValue($name);

                if ($addScheme) {
                    $this->upgradeUrl($value);
                } else {
                    $this->downgradeUrl($value);
                }

                $node->setProperty($name, $value);
            }
        }
    }
388851
public function setAddress(MageQuote $quote)
    {
        $billing = $this->sgBase->getInvoiceAddress();
        if (!empty($billing)) {
            $data = $this->sgCustomer->createAddressData($this->sgBase, $billing, $quote->getCustomerId());
            $quote->getBillingAddress()
                  ->addData($data)
                  ->setCustomerAddressId($billing->getId())
                  ->setCustomerId($this->sgBase->getExternalCustomerId())
                  ->setData('should_ignore_validation', true);
        }

        $shipping = $this->sgBase->getDeliveryAddress();
        if (!empty($shipping)) {
            $data = $this->sgCustomer->createAddressData($this->sgBase, $shipping, $quote->getCustomerId());
            $quote->getShippingAddress()
                  ->addData($data)
                  ->setCustomerAddressId($shipping->getId())
                  ->setCustomerId($this->sgBase->getExternalCustomerId())
                  ->setData('should_ignore_validation', true);
        }

        if (!$quote->getShippingAddress()->getCountryId()) {
            $defaultCountryItem = $this->sgCoreConfig->getConfigByPath(Custom::XML_PATH_GENERAL_COUNTRY_DEFAULT);
            $quote->getShippingAddress()->setCountryId($defaultCountryItem->getValue());
        }
    }
1289932
protected function buildSet(
        /*# string */ $prefix,
        array $settings
    )/*# : array */ {
        if ($this instanceof UpdateStatementInterface) {
            return $this->buildUpdateSet($prefix, $settings);
        } else {
            return $this->buildInsertSet($prefix, $settings);
        }
    }
789309
public function createCategoryFacetConfigurationTable(SchemaSetupInterface $setup)
    {
        // Create table 'smile_elasticsuitecatalog_category_filterable_attribute'.
        $tableName = 'smile_elasticsuitecatalog_category_filterable_attribute';
        $idField   = $this->metadataPool->getMetadata(CategoryInterface::class)->getIdentifierField();

        $table = $setup->getConnection()
            ->newTable($setup->getTable($tableName))
            ->addColumn(
                $idField,
                \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
                null,
                ['unsigned' => true, 'primary' => true, 'nullable' => false],
                'Category ID'
            )
            ->addColumn(
                'attribute_id',
                \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
                null,
                ['unsigned' => true, 'primary' => true, 'nullable' => false],
                'Attribute Id'
            )
            ->addColumn(
                'position',
                \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
                null,
                ['nullable' => true, 'unsigned' => true],
                'Position'
            )
            ->addColumn(
                'facet_display_mode',
                \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
                null,
                ['nullable' => false, 'default' => '0'],
                'Facet display mode'
            )
            ->addColumn(
                'facet_min_coverage_rate',
                \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
                null,
                ['nullable' => true],
                'Facet min coverage rate'
            )
            ->addColumn(
                'facet_max_size',
                \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
                null,
                ['nullable' => true, 'unsigned' => true],
                'Facet max size'
            )
            ->addColumn(
                'facet_sort_order',
                \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
                25,
                ['nullable' => true],
                'Facet sort order'
            )
            ->addForeignKey(
                $setup->getFkName($tableName, $idField, 'catalog_category_entity', $idField),
                $idField,
                $setup->getTable('catalog_category_entity'),
                $idField,
                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
            )
            ->addForeignKey(
                $setup->getFkName($tableName, 'attribute_id', 'eav_attribute', 'attribute_id'),
                'attribute_id',
                $setup->getTable('eav_attribute'),
                'attribute_id',
                \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
            )
            ->setComment('Facet configuration for each category.');

        $setup->getConnection()->createTable($table);
    }
265198
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
    {
        $setup->startSetup();

        $this->coreSetup->createRelevanceConfigTable($setup);

        $setup->endSetup();
    }
1348653
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
    {
        $setup->startSetup();
        $this->catalogSetup->addEavCatalogFields($setup);
        $this->catalogSetup->addIsSpellcheckedToSearchQuery($setup);

        // Introduced in version 1.1.0.
        $this->catalogSetup->appendDecimalDisplayConfiguration($setup);

        // Introduced in version 1.3.0.
        $this->catalogSetup->createCategoryFacetConfigurationTable($setup);

        // Introduced in version 1.4.0.
        $this->catalogSetup->createSearchPositionTable($setup);

        // Introduced in version 1.5.1.
        $this->catalogSetup->addSortOrderMissingFields($setup);

        $setup->endSetup();
    }
637423
public function set(string $currency): void
    {
        $this->request->session()->put(
            $this->config->key,
            $this->value($currency)
        );
    }
989817
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {
        $setup->startSetup();
        if (version_compare($context->getVersion(), '1.0.5') < 0) {
            /** @var \Mirasvit\Blog\Setup\InstallData\PostSetup $postSetup */
            $postSetup = $this->postSetupFactory->create(['setup' => $setup]);
            foreach ($this->getAttributes() as $code => $data) {
                $postSetup->addAttribute('blog_post', $code, $data);
            }
        }

        $setup->endSetup();
    }
1321811
public function addSetting($setting)
    {
        $data = array(
            'setting_key' => $setting
        );
        
        if (in_array($setting, $this->getSerialized())) {
            $data['serialized'] = '1';
        }
        
        return $this->db->insert($this->getTable(), $data);
    }
527230
public function updateOptimizerSearchContainerTable(SchemaSetupInterface $setup)
    {
        $setup->getConnection()
            ->addColumn(
                $setup->getTable(OptimizerInterface::TABLE_NAME_SEARCH_CONTAINER),
                'apply_to',
                [
                    'type'     => \Magento\Framework\DB\Ddl\Table::TYPE_BOOLEAN,
                    'nullable' => false,
                    'default'  => '0',
                    'comment'  => 'If this optimizer applies to specific entities or not.',
                ]
            );
    }
1049955
private function savePartialData($partialDataSaved, $partialBase, $currBase, $partial, $curr, $quoteId)
    {
        if ($partialDataSaved) {
            /* get saved partial totals */
            $partialSavedBase = $partialDataSaved->getBasePartialAmount();
            $partialSaved = $partialDataSaved->getPartialAmount();
            if (
                ($partialSavedBase != $partialBase) ||
                ($partialSaved != $partial)
            ) {
                if ($partialBase > Cfg::DEF_ZERO) {
                    /* re-save quote partial in registry */
                    $partialDataSaved->setBasePartialAmount($partialBase);
                    $partialDataSaved->setPartialAmount($partial);
                    $this->daoPartialQuote->updateById($quoteId, $partialDataSaved);
                } else {
                    $this->daoPartialQuote->deleteById($quoteId);
                }
            }
        } else {
            if ($partialBase > Cfg::DEF_ZERO) {
                /* create new record in the registry */
                $partialDataSaved = new \Praxigento\Wallet\Repo\Data\Partial\Quote();
                $partialDataSaved->setQuoteRef($quoteId);
                $partialDataSaved->setBasePartialAmount($partialBase);
                $partialDataSaved->setBaseCurrency($currBase);
                $partialDataSaved->setPartialAmount($partial);
                $partialDataSaved->setCurrency($curr);
                $this->daoPartialQuote->create($partialDataSaved);
            }
        }
    }
816298
public static function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
    {
        $installer = $setup;
        $installer->getConnection()->addColumn(
            $installer->getTable('mst_blog_category_entity'),
            'sort_order',
            [
                'type'     => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
                'length'   => null,
                'unsigned' => true,
                'nullable' => false,
                'default'  => 0,
                'comment'  => 'Order'
            ]
        );
    }
807581
protected function setCurrency($currency): void
    {
        if ( ! $currency instanceof Currency) {
            $currency = new Currency(strtoupper($currency));
        }

        $this->currency = $currency;
    }