Problems when creating Migrations - Laravel

Asked

Viewed 433 times

1

I’m in trouble ,to create a Migration in the terminal displays this...

[Symfony\Component\Console\Exception\CommandNotFoundException]
  Command "make:migrations" is not defined.
  Did you mean one of these?
      make:migration
      make:auth
      make:command
      make:controller
      make:event
      make:job
      make:listener
      make:mail
      make:middleware
      make:model
      make:notification
      make:policy
      make:provider
      make:request
      make:seeder
      make:test`

This is a ready project I just want to create the tables and make the relationship ,to then populate in the bank Even when I create a model using the command - php artisan make:model Teste it creates the model a Migration no.

Example of a model of mine : that has no Migration, and that would like to have in the bank

     <?php

     namespace App\Models;
      use Illuminate\Database\Eloquent\Model; 


    class Projetos extends Model{ 

    public $timestamps = false;    
    protected $table = 'projetos';

    protected $IntId = 'id';
    protected $fillable = array('nome', 'area', 'data_criacao', 'data_conclusao_prevista', 
                                 'status', 'porcentagem', 'codigo', 'dono', 'descricao');
    protected $strDataUltimaAtualizacao = 'data_ultima_atualizacao';
    protected $strArquivo = 'arquivo';
    protected $strDescricao = 'descricao';
    protected $strDataArquivoAtualizacao = 'data_arquivo_atualizacao';

    public function areas() {
        return $this->hasOne('App\Models\Area', 'id', 'area');
    }

    public function stakeholders() {
        return $this->belongsToMany('App\Models\Stakeholders', 'projeto_stakeholders', 'id_projeto', 'id_stakeholder');
    }

    public function comentario() {
        return $this->hasMany('App\Models\Comentario', 'id_projeto', 'id');
    }

    public function roles() {
        return $this->belongsToMany('App\Models\Projetos', 'projeto_stakeholders', 'id_projeto', 'id_stakeholder');
    }

}

Another question ,raised there is this model , for me to create it in the bank is with a Migration,this model he has relationships with other models..

Example model Stakeholders:

public $timestamps = false;
protected $table = 'stakeholders';
protected $IntId = 'id';
protected $fillable = array('login', 'nome', 'email');
protected $boolAdmin = 'admin';
protected $boolBoss = 'boss';
protected $strSenha = 'senha';
protected $strTokenResetarSenha = 'token_resetar_senha';

public function projetos() {
    return $this->belongsToMany('App\Models\Projetos', 'projeto_stakeholders', 'id_projeto', 'id_stakeholder');
}

public function comentario() {
    return $this->hasMany('App\Models\Comentario', 'id_stakeholder', 'id');
}

public function roles() {
    return $this->belongsToMany('App\Models\Projetos', 'projeto_stakeholders', 'id_projeto', 'id_stakeholder');
}

The Migration of projects I did was this way ... I wonder if I’m right

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

        $table->increments('id');
        $table->string('nome',200);
        $table->string('area',30);
        $table->date('data_criacao',20);
        $table->date('data_conclusao_prevista',20);
        $table->string('status',40);
        $table->integer('porcentagem',80);
        $table->integer('codigo',10);
        $table->integer('dono',40);
        $table->string('descricao',80);

        //relacao
        $table->integer('id')->unsigned();            
        $table->foreign('id')->references('id')->on('area');

        $table->integer('id')->unsigned();
        $table->integer('id')->references('id')->on('stakeholders');

        $table->integer('id'->unsigned();
        $table->foreign('id')->references('id')->on('comentarios');

I made it based on this video-lesson Creation of relationships between tables

If you’re right, the same logic I do in Migration stakeholders.. correct?

  • How are you giving the command on the terminal? Full command

  • The command normally used for Migrations in the Laravel is: php artisan migrate --seed

  • Thanks a lot!!! Thanks a lot.

1 answer

0


The answer is in the question itself...

Command "make:migrations" is not defined.
  Did you mean one of these?
      make:migration

make:Migrations - is not defined, the command is without the s in the end

php artisan make:migration create_users_table
  • Is there anything else I can do to help? If you can accept it as a better answer for having solved your problem. I believe that other users may also have the same question someday.

  • It is known that to run Migration uses this command php artisan migrate but displays this error - [Symfony\Component\Debug\Exception\FatalThrowableError]&#xA; Parse error: syntax error, unexpected ')', expecting '{' I will edit and show my Migration in the question

  • That, post the Migration that is trying to run, this second error must refer to something missing in it, point and comma, block closure, parentheses...edit in the question that edits the answer tbm

  • I managed to solve Darlei... I’m having a hard time understanding the relationship between tables...

  • You can call me on email, face or skype, I can help you with any questions... [email protected]

Browser other questions tagged

You are not signed in. Login or sign up in order to post.