Spamworldpro Mini Shell
Spamworldpro


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/old/app/code/Cnc/SerialNumber/Setup/Patch/Schema/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/app/code/Cnc/SerialNumber/Setup/Patch/Schema/CreateOrderColumns.php
<?php
/**
 * @license http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 * @author Radosław Łańcucki <[email protected]>
 * @copyright Copyright (c) 2022 Kaliop Digital Commerce (https://digitalcommerce.kaliop.com)
 */
declare(strict_types=1);

namespace Cnc\SerialNumber\Setup\Patch\Schema;

use Magento\Framework\DB\Ddl\Table;
use Magento\Framework\Setup\Patch\SchemaPatchInterface;
use Magento\Framework\Setup\SchemaSetupInterface;

class CreateOrderColumns implements SchemaPatchInterface
{
    /**
     * @var SchemaSetupInterface
     */
    private $setupInterface;

    /**
     * @param SchemaSetupInterface $setupInterface
     */
    public function __construct(SchemaSetupInterface $setupInterface)
    {
        $this->setupInterface = $setupInterface;
    }

    /**
     * Get array of patches that have to be executed prior to this.
     *
     * @return string[]
     */
    public static function getDependencies(): array
    {
        return [];
    }

    /**
     * Get aliases (previous names) for the patch.
     *
     * @return string[]
     */
    public function getAliases(): array
    {
        return [];
    }

    public function apply(): void
    {
        $this->setupInterface->startSetup();
        $connection = $this->setupInterface->getConnection();
        $table = $this->setupInterface->getTable('cnc_serial_number');

        if (!$connection->tableColumnExists($table, 'order_increment_id')) {
            $connection->addColumn(
                $table,
                'order_increment_id',
                [
                    'type' => Table::TYPE_TEXT,
                    'length' => 32,
                    'nullable' => true,
                    'default' => null,
                    'comment' => 'Order Increment ID'
                ]
            );
        }

        if (!$connection->tableColumnExists($table, 'order_created_at')) {
            $connection->addColumn(
                $table,
                'order_created_at',
                [
                    'type' => Table::TYPE_TIMESTAMP,
                    'nullable' => true,
                    'default' => null,
                    'comment' => 'Order Created At'
                ]
            );
        }

        $this->setupInterface->endSetup();
    }
}

Spamworldpro Mini