Migration from 1.0.0 to 1.1.0 :
- Updating the attribute virtual_category_root from type varchar to type int
- Updating the value of the attribute from 'category/13' to '13.

@param \Magento\Eav\Setup\EavSetup $eavSetup EAV module Setup

@return $this
422124
public function updateVirtualCategoryRootTypeToInt(\Magento\Eav\Setup\EavSetup $eavSetup)
    {
        $setup = $eavSetup->getSetup();

        // Fix the attribute type.
        $eavSetup->updateAttribute(Category::ENTITY, 'virtual_category_root', 'backend_type', 'int');

        // Retrieve information about the attribute and storage config.
        $virtualRootAttributeId = $eavSetup->getAttribute(Category::ENTITY, 'virtual_category_root', 'attribute_id');

        $originalTable = $setup->getTable('catalog_category_entity_varchar');
        $targetTable   = $setup->getTable('catalog_category_entity_int');

        $fields = $setup->getConnection()->describeTable($originalTable);

        // We will not use the auto increment field (row_id / entity_id) in the insert from select query.
        unset($fields[$setup->getConnection()->getAutoIncrementField($originalTable)]);
        // "value" field will be replaced on the flight when building the query.
        unset($fields['value']);

        $baseFields = array_keys($fields);

        // Select old value.
        $valueSelect = $setup->getConnection()->select();
        $valueSelect->from($setup->getTable('catalog_category_entity_varchar'), $baseFields)
            ->where('attribute_id = ?', $virtualRootAttributeId)
            ->columns(['value' => new \Zend_Db_Expr('REPLACE(value, "category/", "")')]);

        // Insert old values into the new table.
        $query = $setup->getConnection()->insertFromSelect(
            $valueSelect,
            $targetTable,
            array_merge($baseFields, ['value']),
            AdapterInterface::INSERT_IGNORE
        );
        $setup->getConnection()->query($query);

        // Delete old value.
        $setup->getConnection()->delete($originalTable, "attribute_id = {$virtualRootAttributeId}");

        return $this;
    }
1140395
public function setCategory(\Amulen\ClassificationBundle\Entity\Category $category = null)
    {
        $this->category = $category;

        return $this;
    }
27809
public function addStoreIdColumnToPositionTable(SchemaSetupInterface $setup)
    {
        $tableName = $setup->getTable('smile_virtualcategory_catalog_category_product_position');

        $setup->getConnection()->addColumn(
            $tableName,
            'store_id',
            [
                'type'     => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
                'unsigned' => true,
                'nullable' => false,
                'default'  => 0,
                'comment'  => 'Store ID',
                'after'    => 'product_id',
            ]
        );

        $primaryKeyName = $setup->getConnection()->getPrimaryKeyName($tableName);
        // The existing primary key will be dropped.
        $setup->getConnection()->addIndex(
            $tableName,
            $primaryKeyName,
            ['category_id', 'product_id', 'store_id'],
            AdapterInterface::INDEX_TYPE_PRIMARY
        );

        $setup->getConnection()->addForeignKey(
            $setup->getFkName($tableName, 'store_id', $setup->getTable('store'), 'store_id'),
            $tableName,
            'store_id',
            $setup->getTable('store'),
            'store_id',
            \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
        );
    }
1204776
public function setTreeLeft($v)
    {
        if ($v !== null) {
            $v = (int) $v;
        }

        if ($this->tree_left !== $v) {
            $this->tree_left = $v;
            $this->modifiedColumns[CategoryTableMap::COL_TREE_LEFT] = true;
        }

        return $this;
    }
603248
public function setEn($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->en !== $v) {
            $this->en = $v;
            $this->modifiedColumns[] = CountryPeer::EN;
        }


        return $this;
    }
1067138
public function setContactIdVersion($v)
    {
        if ($v !== null) {
            $v = (int) $v;
        }

        if ($this->contact_id_version !== $v) {
            $this->contact_id_version = $v;
            $this->modifiedColumns[DealerContactInfoVersionTableMap::CONTACT_ID_VERSION] = true;
        }


        return $this;
    }
1002578
public function setCategoryId($v)
    {
        if ($v !== null) {
            $v = (int) $v;
        }

        if ($this->category_id !== $v) {
            $this->category_id = $v;
            $this->modifiedColumns[C2MTableMap::COL_CATEGORY_ID] = true;
        }

        if ($this->aCategory !== null && $this->aCategory->getId() !== $v) {
            $this->aCategory = null;
        }

        return $this;
    }
1016500
public function setDe($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->de !== $v) {
            $this->de = $v;
            $this->modifiedColumns[] = CountryPeer::DE;
        }


        return $this;
    }
1174329
public function setFolderId($v)
    {
        if ($v !== null) {
            $v = (int) $v;
        }

        if ($this->folder_id !== $v) {
            $this->folder_id = $v;
            $this->modifiedColumns[DealerFolderVersionTableMap::FOLDER_ID] = true;
        }


        return $this;
    }
416565
public function setId($v)
    {
        if ($v !== null) {
            $v = (int) $v;
        }

        if ($this->id !== $v) {
            $this->id = $v;
            $this->modifiedColumns[DealerFolderVersionTableMap::ID] = true;
        }

        if ($this->aDealerFolder !== null && $this->aDealerFolder->getId() !== $v) {
            $this->aDealerFolder = null;
        }


        return $this;
    }
117682
public function setAttributeAv(ChildAttributeAv $v = null)
    {
        if ($v === null) {
            $this->setAttributeAvId(NULL);
        } else {
            $this->setAttributeAvId($v->getId());
        }

        $this->aAttributeAv = $v;

        // Add binding for other direction of this n:n relationship.
        // If this object has already been added to the ChildAttributeAv object, it will not be re-added.
        if ($v !== null) {
            $v->addAttributeTypeAvMeta($this);
        }


        return $this;
    }
362281
public function updateCategorySearchableAttributes($eavSetup)
    {
        $setup      = $eavSetup->getSetup();
        $connection = $setup->getConnection();
        $table      = $setup->getTable('catalog_eav_attribute');

        // Set Name and description indexable and searchable.
        $attributeIds = [
            $eavSetup->getAttributeId(\Magento\Catalog\Model\Category::ENTITY, 'name'),
            $eavSetup->getAttributeId(\Magento\Catalog\Model\Category::ENTITY, 'description'),
        ];

        foreach (['is_searchable', 'is_used_in_spellcheck'] as $configField) {
            foreach ($attributeIds as $attributeId) {
                $connection->update(
                    $table,
                    [$configField => 1],
                    $connection->quoteInto('attribute_id = ?', $attributeId)
                );
            }
        }

        // Set url_path indexable.
        $urlPathAttributeId = $eavSetup->getAttributeId(\Magento\Catalog\Model\Category::ENTITY, 'url_path');
        $connection->update(
            $table,
            ['is_searchable' => 1],
            $connection->quoteInto('attribute_id = ?', $urlPathAttributeId)
        );
    }
134001
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {
        $setup->startSetup();
        $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);

        if (version_compare($context->getVersion(), '1.2.0', '<')) {
            $this->catalogSetup->updateCategorySearchableAttributes($eavSetup);
        }

        if (version_compare($context->getVersion(), '1.2.1', '<')) {
            $this->catalogSetup->updateImageAttribute($eavSetup);
        }

        if (version_compare($context->getVersion(), '1.4.1', '<')) {
            $this->catalogSetup->updateImageAttribute($eavSetup);
        }

        $setup->endSetup();
    }
67145
public function setFolderIdVersion($v)
    {
        if ($v !== null) {
            $v = (int) $v;
        }

        if ($this->folder_id_version !== $v) {
            $this->folder_id_version = $v;
            $this->modifiedColumns[DealerFolderVersionTableMap::FOLDER_ID_VERSION] = true;
        }


        return $this;
    }
512549
public function setTeam(ChildTeam $v = null)
    {
        if ($v === null) {
            $this->setId(NULL);
        } else {
            $this->setId($v->getId());
        }

        $this->aTeam = $v;

        // Add binding for other direction of this n:n relationship.
        // If this object has already been added to the ChildTeam object, it will not be re-added.
        if ($v !== null) {
            $v->addTeamVersion($this);
        }


        return $this;
    }
1109537
public static function set_Inet( $inet )
    {
        if( $inet instanceof Inet ) {
            return $inet;
        }
        try {
            $inet = new Inet( $inet );
            return $inet;
        } catch ( \InvalidArgumentException $e ) {
            return null;
        }
    }
1083639
public function setNumber($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->number !== $v) {
            $this->number = $v;
            $this->modifiedColumns[ReferenceTableMap::COL_NUMBER] = true;
        }

        return $this;
    }