Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Mfrancik's avatar

How do I "drop" tables?

My user table migration is out of sync. When I try and rollback all tables everything is rolled back (excluding User because it doesnt exsist), when I migrate, the user table does not migrate. migrate:refresh gives me the following error:

SQLSTATE[HY000]: General error: 1 no such table: users (SQL: drop table "users")

So I believe I need to drop my database and recreate it. How do I do this?

0 likes
5 replies
ctroms's avatar

I wonder why that happened. Did you rename your user migration file perhaps?

If data isn't a concern, the easiest thing to do would be to manually delete all tables including the 'migrations' table and re-run php artisan migrate

You won't be able to use Laravel migrations to do this. You'll have to use the command line, phpmyadmin or Sequel Pro to drop all tables.

Mfrancik's avatar
Mfrancik
OP
Best Answer
Level 3

When you say delete all tables, are you refering to deleting all migration files? I have about 15 tables so I really want to avoid that if possible.

ctroms's avatar

@Mfrancik. No don't delete the migration files. Your migration files are what Laravel uses to perform actions on your database. They aren't the actual tables so deleting them will not help you in this case.

When I say delete the tables, I am referring to deleting the tables in your actual database. So if you are using Sequel Pro to work with your database, login there and drop all of the tables in your database or use the mysql command line. What you are trying to do is start with an empty database so artisan migrate can rebuild its migrations table and all of the tables you've defined in your migrations.

1 like
Mfrancik's avatar

Ah I see make sense. I created a new users migration and got rid of the old one. This fixed the issue.

Thank you @ctroms for the clarification on this topic so I now better understand what is happening.

ctroms's avatar

@Mfrancik. No problem. Glad you got it sorted out.

One additional note. If you deleted the physical migration file, you will also want to delete the corresponding record in your migrations table in your actual database or future attempts to refresh your migration may fail.

1 like

Please or to participate in this conversation.