SQLSTATE[42S02] Problem with artisan tinker

89 views Asked by At

I have a problem with artisan tinker Problem:

Illuminate\Database\QueryException with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'homestead.projects' doesn't exist (SQL: insert into `projects` (`title`, `description`, `updated_at`, `created_at`) values (My first Project, bla bla, 2020-12-18 14:21:42, 2020-12-18 14:21:42))'

my migration file:

<?php

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

class BusinessTable extends Migration
{
    /**
    * Выполнение миграций.
    *
    * @return void
    */
    public function up()
    {
    Schema::create('flights', function (Blueprint $table) {
    $table->increments('id');
    $table->string('name');
    $table->string('mail');
    $table->string('web-site');
    $table->timestamps();
    });
    }

    /**
    * Отмена миграций.
    *
    * @return void
    */
    public function down()
    {
    Schema::drop('business');
    }
}
1

There are 1 answers

0
Abilogos On BEST ANSWER

your problem dosent do anything with Business Migration.

how ever your business migration should be :

Schema::create('business',

not flights . its about Project Table.

you have to create a project migration:

php artisan make:migration projects_table

and populate with required fields:

class ProjectsTable extends Migration
{
    /**
    * Выполнение миграций.
    *
    * @return void
    */
    public function up()
    {
    Schema::create('projects', function (Blueprint $table) {
    $table->increments('id');
    $table->string('title');
    $table->string('description');
    $table->timestamps();
    });
    }

    /**
    * Отмена миграций.
    *
    * @return void
    */
    public function down()
    {
    Schema::drop('projects');
    }
}