示例#1
0
 protected function runMigration($migrationDirectory)
 {
     $directusPath = BASE_PATH;
     require_once $directusPath . '/api/config.php';
     $config = (require $directusPath . '/api/ruckusing.conf.php');
     $dbConfig = getDatabaseConfig(['type' => DB_TYPE, 'host' => DB_HOST, 'port' => DB_PORT, 'name' => DB_NAME, 'user' => DB_USER, 'pass' => DB_PASSWORD, 'directory' => $migrationDirectory, 'prefix' => '']);
     $config = array_merge($config, $dbConfig);
     $main = new Ruckusing_Framework($config);
     $main->execute(['', 'db:setup']);
     $main->execute(['', 'db:migrate']);
 }
示例#2
0
 private function createDatabase()
 {
     if (!file_exists($this->directusPath . '/api/config.php')) {
         echo "Config file does not exists, run [directus config]" . PHP_EOL;
         exit;
     }
     if (!file_exists($this->directusPath . '/api/ruckusing.conf.php')) {
         echo "Migration configuration file does not exists" . PHP_EOL;
         exit;
     }
     $config = (require $this->directusPath . '/api/ruckusing.conf.php');
     $dbconfig = getDatabaseConfig(array('type' => 'mysql', 'host' => DB_HOST, 'port' => 3306, 'name' => DB_NAME, 'user' => DB_USER, 'pass' => DB_PASSWORD, 'directory' => 'directus', 'prefix' => ''));
     $config = array_merge($config, $dbconfig);
     $main = new Ruckusing_Framework($config);
     $main->execute(array('', 'db:setup'));
     $main->execute(array('', 'db:migrate'));
     $this->clear();
 }
示例#3
0
 /**
  * Install the given schema template name
  * @param $name
  * @param $directusPath
  * @throws \Exception
  */
 public static function installSchema($name, $directusPath)
 {
     $directusPath = rtrim($directusPath, '/');
     /**
      * Check if configuration files exists
      * @throws \InvalidArgumentException
      */
     static::checkConfigurationFile($directusPath);
     require_once $directusPath . '/api/config.php';
     $config = (require $directusPath . '/api/ruckusing.conf.php');
     $dbConfig = getDatabaseConfig(['type' => DB_TYPE, 'host' => DB_HOST, 'port' => DB_PORT, 'name' => DB_NAME, 'user' => DB_USER, 'pass' => DB_PASSWORD, 'directory' => 'templates/' . $name, 'prefix' => '']);
     $config = array_merge($config, $dbConfig);
     $main = new Ruckusing_Framework($config);
     $main->execute(['', 'db:migrate']);
 }