2017-01-12 2 views
0

migrate generiert die Ausnahme nach Pivot-Migration von Laravel 5.3.Migration funktioniert nicht nach Pivot-Migration von Laravel 5.3

schema1 : software_houses 
schema2 : skill_domains 

I erzeugt den Befehl make:migration:pivot skill_domains software_houses

und die Migration mit dem Namen skill_domain_software_house

erstellt wird, aber wenn ich php Handwerkers wandern ausführen

folgende Fehler tritt auf:

[Symfony\Component\Debug\Exception\FatalThrowableError]  
Class 'CreateSkillDomainSoftwareHousePivotTable' not found 

See this Image

SKILL Domain

<?php 

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

class CreateSkillDomainsTable extends Migration 
{ 
    /** 
    * Run the migrations. 
    * 
    * @return void 
    */ 
    public function up() 
    { 

     Schema::create('skill_domains', function (Blueprint $table) { 
      $table->increments('id'); 
      $table->string('name')->unique(); 
      $table->timestamps(); 
     }); 


    } 

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

Software House

<?php 

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

class CreateSoftwareHousesTable extends Migration 
{ 
    /** 
    * Run the migrations. 
    * 
    * @return void 
    */ 
    public function up() 
    { 
     Schema::create('software_houses', function (Blueprint $table) { 
      $table->increments('id'); 
      $table->string('name',100)->unique(); 
      $table->string('desc',500); 
      $table->string('url',100); 
      $table->string('rating')->default('3'); 
      $table->string('logo')->nullable(); 
      $table->string('city')->nullable(); 

      $table->timestamps(); 
     }); 
    } 

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

Pivot-Tabelle nach dem Ausführen des make erstellt: Migration :: Pivot-Befehl

<?php 

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

class CreateSkill_domainSoftware_housePivotTable extends Migration 
{ 
    /** 
    * Run the migrations. 
    * 
    * @return void 
    */ 
    public function up() 
    { 
     Schema::create('skill_domain_software_house', function (Blueprint $table) { 
      $table->integer('skill_domain_id')->unsigned()->index(); 
      $table->foreign('skill_domain_id')->references('id')->on('skill_domains')->onDelete('cascade'); 
      $table->integer('software_house_id')->unsigned()->index(); 
      $table->foreign('software_house_id')->references('id')->on('software_houses')->onDelete('cascade'); 
      $table->primary(['skill_domain_id', 'software_house_id']); 
     }); 
    } 

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

Was ist Ihr 'skill_domain_software_house' migration' class' Name? –

+0

SkillDomain_SoftwareHouse – user1809029

+0

Ist es wichtig, das Modell vor der Migration zu erstellen? – user1809029

Antwort

0

Versuchen mit folgenden Klassennamen Zeile: class SkillDomainsSoftwareHouses extends Migration

Vergewissern Sie sich der Dateiname übereinstimmen mit Klassennamen Documentation sein sollte.

UPDATE
Ich glaube, Sie dies versuchen sollte:

unten beschriebenen Schritte

zuerst über software_houses, skill_domains von Migrationen entfernen Ordner auch dann folgen aus Migrationen Tabelle in Ihrer Datenbank entfernen:

1) php artisan make:migration skilldomain 
2) php artisan make:migration softwarehouses 
3) php artisan make:migration:pivot skilldomains softwarehouses 
4) php artisan migrate 
+0

können Sie etwas mehr Details geben. Wenn ich php Handwerker machen: Migration: Dreh skill_domains software_houses was schief gehen könnte als Laravel die Standardnamenskonventionen – user1809029

+0

Dokumentation alles verwendet haben, was Sie wollen mehr? Übrigens, zeigen Sie Ihren Migrationscode an. –

+0

@ user1809029: Platzieren Sie Ihren Code in Ihren Frageteil. –

Verwandte Themen