TastyIgniter icon indicating copy to clipboard operation
TastyIgniter copied to clipboard

[Bug]: Error Installing Tastyigniter 4.0.0: Database Index Name Too Long

Open pinalgirkar opened this issue 9 months ago • 2 comments

What happened?

I was attempting to install Tastyigniter 4.0.0 on AlmaLinux 8.10 using the following CLI command, with the system requirements being Apache 2.2, PHP 8.3, and MySQL 8.0.

composer create-project tastyigniter/tastyigniter:^v4.0 tastyigniter

Once the package was downloaded, I began the setup process with this command: php artisan igniter:install

After entering the database details, I encountered the following error:

igniter.api::2020_05_18_000300_create_access_tokens_table ..... 24.03ms FAIL

Illuminate\Database\QueryException

SQLSTATE[42000]: Syntax error or access violation: 1059 Identifier name 'preta_igniter_api_access_tokens_tokenable_type_tokenable_id_index' is too long (Connection: mysql, SQL: alter table `preta_igniter_api_access_tokens` add index `preta_igniter_api_access_tokens_tokenable_type_tokenable_id_index`(`tokenable_type`, `tokenable_id`))

at vendor/laravel/framework/src/Illuminate/Database/Connection.php:825
    821▕                     $this->getName(), $query, $this->prepareBindings($bindings), $e
    822▕                 );
    823▕             }
    824▕
  ➜ 825▕             throw new QueryException(
    826▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    827▕             );
    828▕         }
    829▕     }

+46 vendor frames

47  artisan:35
    Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

It seems that the error is caused by the length of the index name, preta_igniter_api_access_tokens_tokenable_type_tokenable_id_index, which exceeds the maximum allowed length for index names in MySQL.

Can you please check this and fix it.

Regards

What did you expect to happen?

It should install properly without any error.

laravel.log

Version

Other (please detail)

What browser are you seeing the problem on?

No response

Relevant log output

igniter.api::2020_05_18_000300_create_access_tokens_table ..... 24.03ms FAIL

Illuminate\Database\QueryException

SQLSTATE[42000]: Syntax error or access violation: 1059 Identifier name 'preta_igniter_api_access_tokens_tokenable_type_tokenable_id_index' is too long (Connection: mysql, SQL: alter table `preta_igniter_api_access_tokens` add index `preta_igniter_api_access_tokens_tokenable_type_tokenable_id_index`(`tokenable_type`, `tokenable_id`))

at vendor/laravel/framework/src/Illuminate/Database/Connection.php:825
    821▕                     $this->getName(), $query, $this->prepareBindings($bindings), $e
    822▕                 );
    823▕             }
    824▕
  ➜ 825▕             throw new QueryException(
    826▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    827▕             );
    828▕         }
    829▕     }

+46 vendor frames

47  artisan:35
    Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

pinalgirkar avatar Mar 10 '25 07:03 pinalgirkar

Try with a shorter database prefix. Two characters maybe.

sampoyigi avatar Mar 10 '25 08:03 sampoyigi

Hello @sampoyigi ,

I encountered too with the same issue using PHP 8.3, MYSQL 8, Apache 2.4.

However, for me it works with a 5 character MYSQL table prefix (including '' character) (tblt), when I tested.

But using tblts_(6 character MYSQL table prefix) it fails.

It throws same issue as @pinalgirkar has mentioned i.e :


 Illuminate\Database\QueryException

  SQLSTATE[42000]: Syntax error or access violation: 1059 Identifier name 'tblts_igniter_api_access_tokens_tokenable_type_tokenable_id_index' is too long (Connection: mysql, SQL: alter table `tblts_igniter_api_access_tokens` add index `tblts_igniter_api_access_tokens_tokenable_type_tokenable_id_index`(`tokenable_type`, `tokenable_id`))

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:825
    821▕                     $this->getName(), $query, $this->prepareBindings($bindings), $e
    822▕                 );
    823▕             }
    824▕
  ➜ 825▕             throw new QueryException(
    826▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    827▕             );
    828▕         }
    829▕     }

      +46 vendor frames

  47  artisan:35
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

Is there any specific character length restriction added to Tastyigniter 4.0.0 code for MYSQL table prefix?.

Could you please check and replicate?.

Kindly let me know.

prbt2016 avatar Mar 10 '25 12:03 prbt2016

This issue looks fixed. Closing, but please reopen if it still occurs.

sampoyigi avatar Sep 12 '25 21:09 sampoyigi