Skip to content

Instantly share code, notes, and snippets.

@silentworks
Created October 13, 2012 09:30
Show Gist options
  • Save silentworks/3883950 to your computer and use it in GitHub Desktop.
Save silentworks/3883950 to your computer and use it in GitHub Desktop.
Formz ALTER table
<?php
/**
* Formz
*
* Resolve changes to db model
*
* @package Formz
* @subpackage build
*/
if ($object->xpdo) {
switch ($options[xPDOTransport::PACKAGE_ACTION]) {
case xPDOTransport::ACTION_INSTALL:
case xPDOTransport::ACTION_UPGRADE:
$modx =& $object->xpdo;
$modelPath = $modx->getOption('formz.core_path',null,$modx->getOption('core_path').'components/formz/').'model/';
$modx->addPackage('formz',$modelPath);
$formzValidation = $modx->getTableName('fmzFormsValidation');
$sql = "ALTER TABLE {$formzValidation} ADD `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (`id`)";
$modx->exec($sql);
break;
}
}
return true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment