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


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)

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

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



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
  • You shouldn't use this command with "sudo". – Kevin Krieger Aug 11 '16 at 7:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.