前提・実現したいこと
laravel5.5でマイグレーションを実行時にエラーが発生し
解決できず困っています。
エラー発生までの手順は以下になります。
//マイグレーションファイル作成 $ php artisan make:migration create_tests_table --create=tests //マイグレーションファイル修正 ファイルは下記記載 // マイグレーションフの実行 $ php artisan migrate
//エラー内容 In Connection.php line 664: SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name '' (SQL: create table `` (`id` int unsigned not null auto_increment primary key, `migration` varchar(255) not null, `batch` int not nu ll) default character set utf8mb4 collate utf8mb4_unicode_ci) In Connection.php line 452: SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name ''
マイグレーションファイル
php
1<?php 2 3use Illuminate\Support\Facades\Schema; 4use Illuminate\Database\Schema\Blueprint; 5use Illuminate\Database\Migrations\Migration; 6 7class CreateTestsTable extends Migration 8{ 9 /** 10 * Run the migrations. 11 * 12 * @return void 13 */ 14 public function up() 15 { 16 Schema::create('tests', function (Blueprint $table) { 17 $table->increments('id'); 18 $table->string('name'); 19 $table->timestamps(); 20 }); 21 } 22 23 /** 24 * Reverse the migrations. 25 * 26 * @return void 27 */ 28 public function down() 29 { 30 Schema::dropIfExists('tests'); 31 } 32} 33
試したこと
エラー内容を検索
テーブル名が''が原因だと思いますので
マイグレーションファイルを再作成(テーブル名を別の名前に変更)
しましたが、何度やっても解決できませんでした。
laravelのプロジェクト内でのDBの接続はできています。
よろしくお願いいたします。
補足情報(FW/ツールのバージョンなど)
Laravel 5.5
PHP 7.1
MySQL 5.6
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。