Question

I have readed about similar problems in here, but it seems to be somehow different from mine.

I have developed a Form builder plugin and it worked perfectly on my test server, and another private server i have. The problem is, when i upload this on another customers Magento shop, i cannot "add a form" i get the following error message:

SQLSTATE[42S02]: Base table or view not found: 1146 Table '123.gjd4_formbuilder_forms' doesn't exist, query was: DESCRIBE `gjd4_formbuilder_forms`

I dont get why it does this, my test server magentos are updated 100% and same for my customer. How do i solve this problem?

Thanks in advance guys, hope you all have a nice day.

<?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();
Was it helpful?

Solution

If the table is not there it could be possible that the update script didn't run for different reasons.

First check with this query the version of your module:

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

If the version is the same as config.xml then that could be the reason why did not run.

If you are not using update scripts then this is a good reason why you should use them, but for now you can create the table manually. To create the table you can run this query in your test server where your table exists:

SHOW CREATE TABLE gjd4_formbuilder_forms;

Then use the result to create the table in your other server. After that flush cache and try again.

Finally as mentioned on the comment by @tecjam check the db prefixes.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top