0

Please, how can i resolve this problem? my setup script doesn't work when i enable my module using this command:

php bin/magento module:enable Demo_Demo

<?php


namespace Demo\Demo\Setup;

use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\Setup\ModuleContextInterface;

class InstallSchema implements InstallSchemaInterface
{
    public function install(SchemaSetupInterface $setup)
    {
        $setup->startSetup();

        $data = [];
        $statuses = [
            'demo_payed' => __('payed'),
            'demo_error' => __('error'),
            'demo_processing'  => __('processing'),
        ];
        foreach ($statuses as $code => $info) {
            $data[] = ['status' => $code, 'label' => $info];
        }

        $setup->getConnection()
            ->insertArray($setup->getTable('sales_order_status'), ['status', 'label'], $data);

        $setup->endSetup();
    }

}

1 Answer 1

0

First check in database table setup_module have your module entry delete it and Go to CLI and run below command:

sudo php bin/magento setup:upgrade
1
  • You shouldn't use this command with "sudo". Commented Aug 11, 2016 at 7:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.