Sterc / FormIt

A dynamic form processing Snippet for MODX Revolution
https://docs.modx.com/current/en/extras/formit
33 stars 58 forks source link

Error on updating #44

Closed mimamuh closed 8 years ago

mimamuh commented 9 years ago

Hi,

I've tried to update formit from 2.2.2(?) to 2.2.4 and got the following error: Error adding field FormItForm->encrypted: Array ( [0] => 42S02 [1] => 1146 [2] => Table 'modx.modx_formit_forms' doesn't exist )

But it claims to be successfully installed at the end. Any idea?

jhnpldng commented 9 years ago

Same thing here and confirmed the table indeed doesn't exist. I would make the table if I knew what columns it needed. I've noticed the same problem with a lot of packages. Table doesn't exist. Some kind of permission issue or our db settings within modx maybe? Not allowing packages to create tables?

Bumme commented 9 years ago

@MiMaMuh @jhnpldng Could you specify some more information?

MODX version Server specs Update from which MODX version Table prefix

jhnpldng commented 9 years ago

Bitnami Stack Modx 2.3.3pl localhost apache2/mysql/php5 n/a modx_ Being a straight up bitnami configuration, I would think it would work out of the box.

Bumme commented 9 years ago

@jhnpldng Strange that the table isn't created. Should work like a charm. The error that @MiMaMuh had is an MODX fault. For an update i've added the functionality to add a field but if the field is already exists he will gave an error but that's nothing to worry about.

The table that you need to create is : screen shot 2015-04-23 at 11 32 30

mimamuh commented 9 years ago

@Bumme thx, I've created the table manually and now the update works.

jgulledge19 commented 9 years ago

@Bumme I got the same error. Upgraded from 2.2.1pl to 2.2.4pl on MODX 2.3. I believe this is because the ACTION_UPGRADE: https://github.com/modxcms/FormIt/blob/develop/_build/resolvers/resolve.tables.php assumes that you have already installed the table, which would not be possible if you have installed FormIt before this table was created. I think all you need to do is either move this line:

$manager->createObjectContainer('FormItForm'); 

above the switch or also have it in ACTION_UPGRADE. I am 95% sure that the createObjectContainer() method is smart enough to not cause an error if the DB table already exists and it runs.

jgulledge19 commented 9 years ago

@jhnpldng or anyone else that did not get the Table to install on upgrade. You can easy install the DB table by doing the following after you have upgraded to 2.2.4:

$modelPath = $modx->getOption('formit.core_path',null,$modx->getOption('core_path').'components/formit/').'model/';

$modx->addPackage('formit',$modelPath);
$manager = $modx->getManager();
$manager->createObjectContainer('FormItForm');

return 'Installed FormIt DB Table';
joeke commented 8 years ago

@jgulledge19 @MiMaMuh The suggested fix was implemented in version 2.2.5, and therefore I'm closing this issue.