Your IP : 216.73.216.220


Current Path : /var/www/html/app/code/FlipsDigital/TextbookList/Setup/
Upload File :
Current File : /var/www/html/app/code/FlipsDigital/TextbookList/Setup/UpgradeData.php

<?php

namespace FlipsDigital\TextbookList\Setup;

use Magento\Framework\Setup\UpgradeDataInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface;

class UpgradeData implements UpgradeDataInterface
{
	protected $textbooklistSetupFactory;

	public function __construct(TextbookListSetupFactory $textbooklistSetupFactory)
    {
        $this->textbooklistSetupFactory = $textbooklistSetupFactory;
    }

	public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
	{
		$setup->startSetup();
        $eavSetup = $this->textbooklistSetupFactory->create(['setup' => $setup]);

        if (version_compare($context->getVersion(), '0.0.2', '<')) {
            $eavSetup->addAttribute(
                \FlipsDigital\TextbookList\Model\TextbookList::ENTITY,
                'school_remark',
                [
                    'type' => 'text',
                    'label' => 'School Remark',
                    'input' => 'textarea',
                    'required' => true,
                    'sort_order' => 100,
                    'global' => ScopedAttributeInterface::SCOPE_STORE,
                    'group' => 'General',
                    'wysiwyg_enabled' => true,
                ]
            );
        }
        if (version_compare($context->getVersion(), '0.0.3', '<')) {
            $eavSetup->addAttribute(
                \FlipsDigital\TextbookList\Model\TextbookList::ENTITY,
                'GroupTableTitle',
                [
                    'type' => 'varchar',
                    'label' => 'Group Table Title',
                    'input' => 'text',
                    'sort_order' => 100,
                    'global' => ScopedAttributeInterface::SCOPE_STORE,
                    'group' => 'General',
                ]
            );
        }
        if (version_compare($context->getVersion(), '0.0.4', '<')) {
            $eavSetup->addAttribute(
                \FlipsDigital\TextbookList\Model\TextbookList::ENTITY,
                'synchronization_date',
                [
                    'type' => 'varchar',
                    'label' => 'Synchronization Date',
                    'input' => 'text',
                    'sort_order' => 100,
                    'global' => ScopedAttributeInterface::SCOPE_STORE,
                    'group' => 'General',
                ]
            );
        }
        if (version_compare($context->getVersion(), '0.0.5', '<')) {
            $eavSetup->addAttribute(
                \FlipsDigital\TextbookList\Model\TextbookList::ENTITY,
                'sync_data_start_date',
                [
                    'type' => 'datetime',
                    'label' => 'Sync Data Start Date',
                    'input' => 'datetime',
                    'sort_order' => 100,
                    'global' => ScopedAttributeInterface::SCOPE_STORE,
                    'group' => 'General',
                ]
            );
            $eavSetup->addAttribute(
                \FlipsDigital\TextbookList\Model\TextbookList::ENTITY,
                'sync_data_end_date',
                [
                    'type' => 'datetime',
                    'label' => 'Sync Data End Date',
                    'input' => 'datetime',
                    'sort_order' => 100,
                    'global' => ScopedAttributeInterface::SCOPE_STORE,
                    'group' => 'General',
                ]
            );
            $eavSetup->addAttribute(
                \FlipsDigital\TextbookList\Model\TextbookList::ENTITY,
                'hm_last_update_date',
                [
                    'type' => 'datetime',
                    'label' => 'HM Last Update Date',
                    'input' => 'datetime',
                    'sort_order' => 100,
                    'global' => ScopedAttributeInterface::SCOPE_STORE,
                    'group' => 'General',
                ]
            );
            $eavSetup->addAttribute(
                \FlipsDigital\TextbookList\Model\TextbookList::ENTITY,
                'need_to_sync',
                [
                    'type' => 'int',
                    'label' => 'Need To Sync',
                    'input' => 'select',
                    'sort_order' => 100,
                    'global' => ScopedAttributeInterface::SCOPE_STORE,
                    'group' => 'General',
                    'default' => '0',
                ]
            );
        }
        if (version_compare($context->getVersion(), '0.0.6', '<')) {
            $eavSetup->addAttribute(
                \FlipsDigital\TextbookList\Model\TextbookList::ENTITY,
                'mers_stock_source_g_gl_plastic_bag_levy_amount',
                [
                    'type' => 'decimal',
                    'label' => 'MersStock - Source [G_GL].[PLASTIC_BAG_LEVY_AMOUNT]',
                    'input' => 'text',
                    'sort_order' => 100,
                    'global' => ScopedAttributeInterface::SCOPE_STORE,
                    'group' => 'General',
                ]
            );
        }

        $setup->endSetup();
	}
}