skip to Main Content

enter image description here

enter image description here

When ran php artisan migrate it will show out error.

I try drop all file and install again, it show out this why?

2023_03_09_044748_create_tag_tables …………………………… 6ms FAIL

IlluminateDatabaseQueryException

3

Answers


  1. you have two tables named "tags" in your migration files
    _create_tags_table and _create_tag_table
    check the create method in both migrations and rename or delete one.

    enter image description here

    Login or Signup to reply.
  2. The problem is in 2023_03_09_044748_create_tag_tables, Change the table name to tag

    Run
    composer dump-autoload and then php artisan migrate:fresh

    Login or Signup to reply.
  3. You should make sure to name tables the "Laravel way" and follow their naming conventions.

    In this case, you named the migration ..._create_tag_tables, but the table you create is called tags. Make sure to name the migration the same way.

    You already have a migration that creates the tags table. If you want to change that one, you have two options:

    If not deployed yet, you can update the existing migration to your needs. Then run php artisan migrate:fresh, what will empty the database and set it up again (all data will get lost).

    But never change deployed (or better even pushed) migrations as they will not be run again.

    In that case, create a new migration that updates the already existing table.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search