2016-07-17 9 views
0

laravelによって作成され、私は移行ファイルを得た溶液を塗布した後How is a pivot table created by laravelで同じ問題を発見し、私は私の変更を行ってきましたがどのようにピボットテーブルは、私が<a href="http://four.laravel.com/docs/eloquent#many-to-many" rel="nofollow noreferrer">http://four.laravel.com/docs/eloquent#many-to-many</a>ですべてを続く5

public function up() 
    { 
     Schema::table('Card_User', function (Blueprint $table) { 
      $table->increments('id'); 
      $table->integer('Card_id'); 
      $table->integer('User_id'); 
      $table->integer('additional_var'); 
     }); 
    } 

しかしとき

:私は、私はいつも私が試したいくつかの他のウェブページへのfolowwing後

[Illuminate\Database\QueryException]            
    SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db.Card_User' d 
    oesn't exist (SQL: alter table `Card_User` add `id` int unsigned not null auto 
    _increment primary key, add `Card_id` int not null, add `User_id` int not null 
    , add `additional_var` int not null)          



    [PDOException]                 
    SQLSTATE[42S02]: Base table or view not found: 1146 Table 'waawia.Card_User' d 
    oesn't exist 

を取得php artisan migrate:refreshにしてみてください

  • php artisan migrate:install

...手動ですべてのデータベーステーブルを削除し、

  • php artisan serveを再開し、今では

  • いくつかの他の事を閉じています移行をリフレッシュしかし、まだ同じ問題がある

  • 答えて

    1

    あなたがテーブルを作成している場合、

    Schema::create('Card_User', function (Blueprint $table) {}

    Schema::table()

    Schema::table('Card_User', function (Blueprint $table) {}

    を変更するにはSchema::create()が、それが意味するものをしながら、既存のテーブルを変更するために使用されます。

    +0

    ありがとうございました:私はたくさん働いていましたが、今までそれを見つけられませんでした。あなたの答えを最高のものとして選びます。ちょっと^ _ ^ありがとうございます –

    関連する問題

     関連する問題