2016-08-30 15 views
0

アプリケーションにマイグレーションルートがあり、現在の出力は:Laravel 5:Migration-Route - Artisan :: call( 'migrate'、array( '-force' => true))

init migrate:install...done migrate:install 
init with tables migrations... 

これで停止します。しかし、出力は続けるべきです。 HERESにルート:

Route::get('/migrate', function() { 
    try { 
     try { 
      echo '<br>init migrate:install...'; 
      Artisan::call('migrate:install'); 
      echo 'done migrate:install'; 
     } catch (Exception $e) { 
      echo 'allready installed'; 
     } 

     echo '<br>init with tables migrations...'; 
     Artisan::call('migrate', array('--force' => true)); // here it stops via browser 
     echo 'done with migrations'; 

     echo '<br>clear view cache...'; 
     $cachedViewsDirectory = app('path.storage').'/framework/views/'; 

     if ($handle = opendir($cachedViewsDirectory)) { 
      while (false !== ($entry = readdir($handle))) { 
       if(strstr($entry, '.')) continue; 

       @unlink($cachedViewsDirectory . $entry); 
      } 

      closedir($handle); 
     } 
     echo 'all view cache cleared'; 

     return redirect()->route('backend::dashboard'); 
    } catch (Exception $e) { 
     Response::make($e->getMessage(), 500); 
    } 
}); 

シェルにアクセスしながら、それが動作します、移行を実行します。それはルートから動作しないのはなぜ

-bash-4.2$ /opt/plesk/php/5.6/bin/php artisan migrate 
************************************** 
*  Application In Production!  * 
************************************** 

Do you really wish to run this command? (yes/no) [no]: 
> yes 

Migrated: 2016_08_23_194102_import_old_data 
Migrated: 2016_08_25_080129_import_old_adresses 
Migrated: 2016_08_25_080801_import_oldname_to_accountholder 

を?

UPDATE

Apacheのログは、そのHTTPのOKので、復帰状態200で "HTTP/1.0を移行/ GET" を示しています。

ブラウザのDEVツールでもエラーは発生しません。

UPDATE 2

もlaravel.logは空です。移行ルートの呼び出し中に新しいエントリはありません。

答えて

0

OKを投稿してください。

オリジナル移行(私は馬鹿それを掲示していた場合ウィッヒは便利となってしまう場合があります)

/** 
* Run the migrations. 
* 
* @return void 
*/ 
public function up() 
{ 
    // Load data to be imported. 
    $oldOrders = json_decode(File::get('storage/olddata.json'), TRUE); 

    // Update. 
    foreach ($oldOrders as $rawOrder) { 
     /* @var \App\Order $order */ 
     $order = \App\Order::find(intval($rawOrder['id'])); 

     // Check whether order is payed. 
     if ($order->isPayed() === FALSE && floatval($rawOrder["payedAmount"]) != 0) { 
      /* @var \App\Payment $payment */ 
      $payment = new \App\Payment(); 

      $payment->order_id = $order->id; 
      $payment->amount = $rawOrder["payedAmount"]; 
      $payment->method = $rawOrder["paymentMethod"]; 

      $payment->save(); 
     } 
    } 
} 

そして移行は今

/** 
* Run the migrations. 
* 
* @return void 
*/ 
public function up() 
{ 
    // Load data to be imported. 
    $oldOrders = json_decode(File::get(base_path('storage/olddata.json')), TRUE); 

    // Update. 
    foreach ($oldOrders as $rawOrder) { 
     /* @var \App\Order $order */ 
     $order = \App\Order::find(intval($rawOrder['id'])); 

     // Check whether order is payed. 
     if ($order->isPayed() === FALSE && floatval($rawOrder["payedAmount"]) != 0) { 
      /* @var \App\Payment $payment */ 
      $payment = new \App\Payment(); 

      $payment->order_id = $order->id; 
      $payment->amount = $rawOrder["payedAmount"]; 
      $payment->method = $rawOrder["paymentMethod"]; 

      $payment->save(); 
     } 
    } 
} 

ローカル環境で私はシェルから移行しました。スタート地点に/があります。しかしルートでは、スタート地点は他のものと思われ、は例外を投げた。しかし、それは決して記録されませんでした。移行前後でtry{}catch(\Exception $e){}を追加してエラーが発生しました。

0

はエラー、オープン開発ツール>ネットワーク]タブ、またはapacheのエラーログ、私はそれを実行しました

+0

これはコメントですが、回答はありません。 – lippoliv

+0

は評判が上がるまではコメントできません...しかし、私はコメントに自動的に追加されているとは思えますが、@lippoliv – Sherif

+0

ああ。それを知らなかった。うまくいけば、私のアップデートが役立つでしょう。 TY – lippoliv

関連する問題