Gagal Migration Laravel

Selamat sore, perkenalkan saya rudi. saya memiliki masalah saat melakukan migration. Disini saya memiliki kode sebagai berikut

<?php

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

class CreateMSatuanTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('m_satuan', function (Blueprint $table) {
            $table->increments('id');
            $table->string('kode');
            $table->string('nama');
            $table->text('deskripsi')->nullable();
        });
    }

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

saat saya menjalankan perintah

php artisan migrate

saya mendapatkan eror

   Illuminate\Database\QueryException  : SQLSTATE[42S02]: Base table or view not found: 1146 Table 'warehouse_api.m_satuan' doesn't exist (SQL: alter table `m_satuan` add `id` int unsign
ed not null auto_increment primary key, add `kode` varchar(191) not null, add `nama` varchar(191) not null, add `deskripsi` text null)

  at C:\xampp\htdocs\smartwarehouse-api\vendor\laravel\framework\src\Illuminate\Database\Connection.php:664
    660|         // If an exception occurs when attempting to run a query, we'll format the error
    661|         // message to include the bindings with SQL, which will make this exception a
    662|         // lot more helpful to the developer instead of just the database's errors.
    663|         catch (Exception $e) {
  > 664|             throw new QueryException(
    665|                 $query, $this->prepareBindings($bindings), $e
    666|             );
    667|         }
    668|

  Exception trace:

  1   PDOException::("SQLSTATE[42S02]: Base table or view not found: 1146 Table 'warehouse_api.m_satuan' doesn't exist")
      C:\xampp\htdocs\smartwarehouse-api\vendor\laravel\framework\src\Illuminate\Database\Connection.php:458

  2   PDOStatement::execute()
      C:\xampp\htdocs\smartwarehouse-api\vendor\laravel\framework\src\Illuminate\Database\Connection.php:458

  Please use the argument -v to see more details.

saya sudah mengikuti tutorial di google (stackoverflow) dan di youtube tapi hasilnya tetap eror. erornya dan kodingannya ada di gambar di bawah ini. Gambar Ukuran penuh <a href='https://postimg.cc/ns9t3Xdv '>https://postimg.cc/ns9t3Xdv</a>

saya mohon bantuannya ya teman teman, karena ini sangat penting sekali.

avatar ruditjahngambeg
@ruditjahngambeg

38 Kontribusi 7 Poin

Diperbarui 5 tahun yang lalu

Tanggapan

  1. coba upload gamarnya lebih jelas 2. ceritakan apa yang dibuat kodenya tampikan, masalahnya apa

pertanyaannya sudah saya update mas.

mantap! jelas! selamat bergabung Rudi!

1 Jawaban:

Jawaban Terpilih

Hey Rudi! kalo kamu mau bikin table, gunakan Schema::create bisa cek di <a href=' https://laravel.com/docs/5.7/migrations'>dokumentasi migaritons</a> Kamu sekarang tulisnya Schema::table. ini untuk membuat kolom

avatar hilmanski
@hilmanski

2665 Kontribusi 2131 Poin

Dipost 5 tahun yang lalu

Tanggapan

Astaga iya lupa saya, terima kasih jawabannya mas. Mas request buat tutorial golang ya.

sama sama Rudi!

Login untuk ikut Jawaban