Advertisement
Guest User

Untitled

a guest
Dec 17th, 2010
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.91 KB | None | 0 0
  1. <?php
  2.  
  3. use Doctrine\ORM\Tools\SchemaTool;
  4.  
  5. // Define path to application directory
  6. defined('APPLICATION_PATH')
  7.     || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../application'));
  8.  
  9. // Define application environment
  10. define('APPLICATION_ENV', 'testing');
  11.  
  12. // Ensure library/ is on include_path
  13. set_include_path(implode(PATH_SEPARATOR, array(
  14.   realpath(APPLICATION_PATH),
  15.   realpath(APPLICATION_PATH . '/../library'),
  16.   get_include_path(),
  17. )));
  18.  
  19. /** Zend_Application */
  20. require_once 'Zend/Application.php';
  21.  
  22. // Create application, bootstrap, and run
  23. $application = new Zend_Application(
  24.     APPLICATION_ENV,
  25.     APPLICATION_PATH . '/configs/application.ini'
  26. );
  27. $application->bootstrap();
  28.  
  29. $em = Zend_Registry::get('em');
  30. $schemaTool = new SchemaTool($em);
  31. $classes = $em->getMetadataFactory()->getAllMetadata();
  32.  
  33. $schemaTool->dropSchema($classes);
  34. $schemaTool->updateSchema($classes);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement