function setUp() { VF_Singleton::getInstance()->setReadAdapter(new VF_TestDbAdapter(array('dbname' => VAF_DB_NAME, 'username' => VAF_DB_USERNAME, 'password' => VAF_DB_PASSWORD))); $schemaGenerator = new VF_Schema_Generator(); $schemaGenerator->dropExistingTables(); VF_Schema::$levels = null; }
function doSetUp() { $schemaGenerator = new VF_Schema_Generator(); $schemaGenerator->dropExistingTables(); $schemaGenerator->execute( array('year', 'make'=>array('global'=>true), 'model') ); $this->startTransaction(); }
function testShouldSetSchema() { $schemaGenerator = new VF_Schema_Generator(); $schemaGenerator->dropExistingTables(); VF_Schema::$levels = null; $command = __DIR__ . '/vfmagento schema --force --levels="year,make,model"'; exec($command); $schema = new VF_Schema(); $this->assertEquals(array('year', 'make', 'model'), $schema->getLevels(), 'should create default schema of MMY'); }
function setUp() { VF_Singleton::reset(); VF_Singleton::getInstance(true); VF_Singleton::getInstance()->setRequest(new Zend_Controller_Request_Http()); $database = new VF_TestDbAdapter(array('dbname' => VAF_DB_NAME, 'username' => VAF_DB_USERNAME, 'password' => VAF_DB_PASSWORD)); VF_Singleton::getInstance()->setReadAdapter($database); $schemaGenerator = new VF_Schema_Generator(); $schemaGenerator->dropExistingTables(); $schemaGenerator->execute(array('make', 'model', 'year')); VF_Schema::reset(); }
function main() { $schema = new VF_Schema(); $schemaGenerator = new VF_Schema_Generator(); $schemaGenerator->dropExistingTables(); $schemaGenerator->execute(array('make', 'model', 'year')); for ($i = 2000; $i <= 2010; $i++) { $vehicleParts = array('make' => 'Honda', 'model' => 'Civic', 'year' => $i); $vehicle = VF_Vehicle::create($schema, $vehicleParts); $vehicle->save(); echo "Created vehicle {$vehicle} \n"; } }
public function indexAction() { try { $schema = new \VF_Schema(); $levels = $schema->getLevels(); } catch (\Zend_Db_Statement_Exception $e) { $levels = array(); } if ($this->getRequest()->isPost()) { $schemaGenerator = new \VF_Schema_Generator(); $schemaGenerator->dropExistingTables(); $schemaGenerator->execute(explode(",", $_POST['schema'])); $this->flashMessenger()->setNamespace('success')->addMessage('Saved Schema'); } return array('schema' => $levels); }
protected function switchSchema($levels, $force = false) { if (!$force) { try { $schema = new VF_Schema(); if ($levels == implode(',', $schema->getLevels())) { $this->startTransaction(); return; } } catch (Zend_Db_Statement_Mysqli_Exception $e) { } catch (Zend_Db_Statement_Exception $e) { } } $schemaGenerator = new VF_Schema_Generator(); $schemaGenerator->dropExistingTables(); $schemaGenerator->execute(explode(',', $levels)); VF_Schema::reset(); $this->startTransaction(); }
* DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Vehicle Fits to newer * versions in the future. If you wish to customize Vehicle Fits for your * needs please refer to http://www.vehiclefits.com for more information. * @copyright Copyright (c) 2013 Vehicle Fits, llc * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ if (file_exists('config.php')) { require_once 'config.php'; } else { require_once 'config.default.php'; } require_once getenv('PHP_MAGE_PATH') . '/app/code/local/Elite/Vaf/bootstrap-tests.php'; $schemaGenerator = new VF_Schema_Generator(); $schemaGenerator->dropExistingTables(); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <link rel="stylesheet" href="qunit/qunit.css" type="text/css"/> </head> <body> <h1 id="qunit-header">VAF - Install Test</h1> <h2 id="qunit-banner"></h2> <h2 id="qunit-userAgent"></h2> <ol id="qunit-tests"> </ol>
function doTearDown() { $schemaGenerator = new VF_Schema_Generator(); $schemaGenerator->dropExistingTables(); }
*/ ?> <fieldset> <legend>Database</legend> Type name of levels separated by comma: <input type="text" name="levels" value="<?php echo isset($_REQUEST['levels']) ? $_REQUEST['levels'] : 'make,model,year'; ?> " /> (ex. "make,model, year") <br /> <input id="generateDB" type="checkbox" name="generateDb" value="1" checked="checked" /> Generate Database SQL <br /> <input id="runDB" type="checkbox" name="runDb" value="1" /> Run Database SQL <?php if (isset($_REQUEST['levels']) && isset($_REQUEST['runDb'])) { $generator = new VF_Schema_Generator(); $generator->dropExistingTables(); $sql = $generator->generator(explode(',', $_REQUEST['levels'])); if (file_exists(ELITE_PATH . '/Vafpaint')) { $generator = new Elite_Vafpaint_Model_Schema_Generator(); $sql .= $generator->install(); } if (file_exists(ELITE_PATH . '/Vafgarage')) { $generator = new Elite_Vafgarage_Model_Schema_Generator(); $sql .= $generator->install(); } foreach (explode(';', $sql) as $statement) { if (!trim($statement)) { continue; } try { $helper->getReadAdapter()->query($statement);