Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Syntax error or access violation: 1103 Incorrect table name

I am trying to migrate the table but it throws an error saying the table name is not valid, Idk why, I check my database there is not even any similar name table, I follow the tutorial and this is working for video guy and not for me. Is there any way to fix it? I’m using laravel version 9

<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('categories', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('slug');
            $table->longText('description');
            $table->tinyInteger('status')->default('0');
            $table->tinyInteger('popular')->default('0');
            $table->string('.meta_title');
            $table->string('.meta_description');
            $table->string('.meta_keyword');
            $table->timestamps();
        });
    }

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

Error


php artisan migrate                               

   INFO  Running migrations.  

  2022_12_04_110615_create_categories_table ............................................................................................... 5ms FAIL

   Illuminate\Database\QueryException 

  SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name '' (SQL: create table `categories` (`id` bigint unsigned not null auto_increment primary key, `name` varchar(191) not null, `slug` varchar(191) not null, `description` longtext not null, `status` tinyint not null default 
'0', `popular` tinyint not null default '0', ``.`meta_title` varchar(191) not null, ``.`meta_description` varchar(191) not null, ``.`meta_keyword` varchar(191) not null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')

 

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

because there is a dot before these columns

$table->string('.meta_title');
$table->string('.meta_description');
$table->string('.meta_keyword');

the compiler will expect the table name before the dot, when there is nothing before the dot it will throw this exception

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading