2016-10-12 5 views
1

Laravel 5.2を使用しています。​​コマンドで移行ファイルを作成しました。ファイルが正常に作成されましたが、このコードでファイルを更新しました:Laravel 5.2データベースの移行エラーが発生しました.2番目のテーブルの移行時に

use Illuminate\Database\Schema\Blueprint; 
use Illuminate\Database\Migrations\Migration; 

class CreateUsersTable extends Migration 
{ 
    /** 
    * Run the migrations. 
    * 
    * @return void 
    */ 
    public function up() 
    { 
     Schema::create('users', function (Blueprint $table) { 
      $table->increments('id'); 
      $table->integer('partner_id'); 
      $table->string('social_id'); 
      $table->integer('device_id'); 
      $table->integer('gcm_id'); 
      $table->integer('user_role'); 
      $table->string('social_media'); 
      $table->string('display_name'); 
      $table->string('first_name'); 
      $table->string('last_name'); 
      $table->integer('status'); 
      $table->string('email')->unique(); 
      $table->string('password'); 
      $table->string('profile_pic'); 
      $table->string('gender'); 
      $table->float('height'); 
      $table->float('weight'); 
      $table->string('dob'); 
      $table->bigInteger('mobile'); 
      $table->string('city'); 
      $table->string('state'); 
      $table->integer('zip'); 
      $table->string('country'); 
      $table->float('latitude'); 
      $table->float('longitude'); 
      $table->float('gps_status'); 
      $table->string('favorite_movie'); 
      $table->string('favorite_food'); 
      $table->string('favorite_weather'); 
      $table->integer('login_status'); 
      $table->string('active'); 
      $table->string('token'); 
      $table->rememberToken(); 
      $table->timestamps(); 
     }); 
    } 

    /** 
    * Reverse the migrations. 
    * 
    * @return void 
    */ 
    public function down() 
    { 
     Schema::drop('users'); 
    } 
}` 

私はこの 'php artisan migrate'コマンドを使用しています。エラーが発生します

'移行テーブルが正常に作成されました。

[Illuminate\Database\QueryException] SQLSTATE[HY000]: General error: 1025 Error on rename of '.\laravel\users' to '.\laravel#sql2-1d88-70' (errno: 190 - Operation not allowed when innodb_forced_recov ery > 0) (SQL: alter table users add unique users_email_unique (email))

[PDOException] SQLSTATE[HY000]: General error: 1025 Error on rename of '.\laravel\users' to '.\laravel#sql2-1d88-70' (errno: 190 - Operation not allowed when innodb_forced_recov ery > 0)'

その後、私はロールバックコマンドphp artisan migrate:rollbackを使用しますが、メッセージはロールバックすることは何も示していないし、私は2番目のテーブルを作成する場合は、メッセージthe user table already existを示しています。

答えて

0

私は、移行が正しく終了していないため、(最後のステップとして)dbテーブルに移行を追加するプロセスが起動されていないため、artisanコマンドを元に戻すことができないそれ。これを解決するには、データベースからテーブルを手動で削除することをお勧めします。

Laravelの新しくインストールされたものがすでにユーザーテーブルに付属しているかどうかは、私の頭の上にある移行自体にあります。まず最初に確認してください。それができれば、テーブルを作成せずにテーブルを変更する必要があります。そうでない場合は、移行が失敗する明白な理由はありません。

関連する問題