Pergunta

Eu li sobre problemas semelhantes aqui, mas parece ser diferente do meu.

Desenvolvi um plugin Form Builder e funcionou perfeitamente no meu servidor de teste e em outro servidor privado que possuo.O problema é que quando eu carrego isso na loja Magento de outro cliente, não consigo "adicionar um formulário", recebo a seguinte mensagem de erro:

SQLSTATE[42S02]:Tabela base ou visualização não encontrada:1146 A tabela '123.gjd4_formbuilder_forms' não existe, a consulta foi:DESCREVER `gjd4_formbuilder_forms`

Não entendo por que isso acontece, meus magentos do servidor de teste estão 100% atualizados e o mesmo para meu cliente.Como eu resolvo este problema?

Agradecemos antecipadamente pessoal, espero que todos tenham um bom dia.

<?php

$installer = $this;

$installer->startSetup();

$installer->run("

-- DROP TABLE IF EXISTS {$this->getTable('formbuilder_forms')};
CREATE TABLE {$this->getTable('formbuilder_forms')} (
    `forms_index` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
    `title` VARCHAR(255) NOT NULL,
    `no_of_fields` INT(50) NULL DEFAULT '0',
    `status` SMALLINT(6) NOT NULL DEFAULT '2',
    `stores` TEXT NULL,
    `header_content` text NOT NULL ,
    `footer_content` text NOT NULL ,
    `success_msg` VARCHAR(255) NULL,
    `failure_msg` VARCHAR(255) NULL,
    `submit_text` VARCHAR(255) NULL,
    `in_menu` SMALLINT(6) NULL DEFAULT '0',
    `in_toplinks` SMALLINT(6) NULL DEFAULT '0',
    `title_image` VARCHAR(255) NULL,
    `bgcolor` VARCHAR(25) NULL DEFAULT '#fbfaf6',
    `created_time` DATETIME NULL DEFAULT NULL,
    `update_time` DATETIME NULL DEFAULT NULL,
    PRIMARY KEY (`forms_index`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

    ");

$installer->run("

-- DROP TABLE IF EXISTS {$this->getTable('formbuilder_fields')};
CREATE TABLE {$this->getTable('formbuilder_fields')} (
    `fields_index` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
    `forms_index` INT(11) NOT NULL,     
    `status` SMALLINT(6) NOT NULL DEFAULT '0',
    `previous_group` VARCHAR(25) NOT NULL,
    `type` VARCHAR(25) NOT NULL,    
    `title` VARCHAR(255) NOT NULL,
    `field_id` INT(11) NOT NULL,
    `options` SMALLINT(6) NOT NULL DEFAULT '0',
    `max_characters` INT(11) NULL,
    `sort_order` INT(11) NULL,  
    `is_require` SMALLINT(6) NOT NULL DEFAULT '0',
    `is_delete` SMALLINT(6) NULL,   
    `file_extension` VARCHAR(255) NULL,
    `image_size_x` INT(11) NULL,
    `image_size_y` INT(11) NULL,    
    `previous_type` VARCHAR(25) NULL,
    `option_id` INT(11) NOT NULL DEFAULT '0',
    PRIMARY KEY (`fields_index`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

    ");

$installer->run("

-- DROP TABLE IF EXISTS {$this->getTable('formbuilder_fields_options')};
CREATE TABLE {$this->getTable('formbuilder_fields_options')} (
    `options_index` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
    `option_id` INT(11) UNSIGNED NOT NULL,
    `fields_index` INT(11) NOT NULL,
    `is_delete` SMALLINT(6) NULL,   
    `title` VARCHAR(255) NOT NULL,
    `sort_order` INT(11) NULL,  
    PRIMARY KEY (`options_index`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

    ");

$installer->run("

-- DROP TABLE IF EXISTS {$this->getTable('formbuilder_records')};
CREATE TABLE {$this->getTable('formbuilder_records')} (
    `records_index` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
    `forms_index` INT(11) NOT NULL,
    `customer` VARCHAR(255) NOT NULL,
    `fields_index` INT(11) NOT NULL,
    `options_index` VARCHAR(255) NULL,
    `value` text NULL,
    PRIMARY KEY (`records_index`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

    ");

$installer->endSetup();
Foi útil?

Solução

Se a tabela não estiver lá, é possível que o script de atualização não tenha sido executado por diferentes motivos.

Primeiro verifique com esta consulta a versão do seu módulo:

select * from core_resource where code like '%your_module_here%';

Se a versão for igual a config.xml, esse pode ser o motivo pelo qual não foi executado.

Se você não estiver usando scripts de atualização, esse é um bom motivo para usá-los, mas por enquanto você pode criar a tabela manualmente.Para criar a tabela você pode executar esta consulta em seu servidor de teste onde sua tabela existe:

SHOW CREATE TABLE gjd4_formbuilder_forms;

Em seguida, use o resultado para criar a tabela em seu outro servidor.Depois disso, limpe o cache e tente novamente.

Finalmente, conforme mencionado no comentário de @tecjam, verifique os prefixos do banco de dados.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a magento.stackexchange
scroll top