I deleted all tables in database, but my error is :
table.questions exists
so I can not migrate them, does it depend on something else as well?
I deleted all tables in database, but my error is :
table.questions exists
so I can not migrate them, does it depend on something else as well?
You can run:
php artisan migrate:refresh
to rollback all the tables (including the migrations table) and recreate everything again.
It's impossible if you really removed all the tables from database.
Make sure you really deleted all tables including migrations
table.
Normally when you want to revert all migrations you should run:
php artisan migrate:reset
If you haven't done this assuming you have are running Laravel 5.5 you can run:
php artisan migrate:fresh
I would advise you to read the whole Migrations documentation to know how they work and how you should create them. In fact you should not remove tables manually and just run:
php artisan migrate:rollback
to rollback migrations previously run or as I already said you can run one one previously mentioned commands to rollback or rollback and run again your migrations.
You get this error because you already have this table in DB. You need to drop a table in down()
method of each migration and use php artisan migrate:rollback
command to delete last batch of executed migrations.
In 5.5 you also can use php artisan migrate:fresh
if you do not drop tables in the down()
method.
https://laravel.com/docs/5.5/migrations#rolling-back-migrations
Or you can just manually recreate a DB and run php artisan migrate
command.
I found it , I had a middleware in boot for question table and added this:
if(\Schema::hasTable('questions')) {
....
}
I've made comments table before and I was making another one for addresses and it said you can't create comments table again!! I delete comments table and migrate again, both tables made successfully.