aahoora's avatar

Error during refresh tables

I use SQLITE and wanted to create my own users table so I removed predefined table and migration users using command:

Schema::drop('users');

after recreating table users, when I tried to refresh my tables by command:

php artisan migrate:refresh

I faced error:

[ErrorException]                                                 
  Undefined index: 2014_10_12_100000_create_password_resets_table

So I removed table and migration password_resets and executed command

composer dump-autoload

but no efffect!

How can I pass this error ?

Laravel 5.4

0 likes
6 replies
aahoora's avatar

@davidpiesse I guess you didn't read my post totally, actually I created my desire table users but when I run php artisan migrate:refresh, It errors!

Cronix's avatar

Was there a migration to create the users table? If so, it's trying to reverse that migration (along with the others) but that table no longer exists since you removed it manually.

You'd have to edit the migrations table and find the date that corresponds to the name of the migration that creates the users table. Or if you don't have a ton of tables yet, just delete the migration table totally along with any other tables that migrations would create and migrate from scratch.

Cronix's avatar

also, check the password resets table migration. It's probably using a foreign key field referencing your users table and in your new users table it doesn't exist.

aahoora's avatar

@Cronix I already removed both migrations and tables for users and password_reset table.

davidpiesse's avatar

If you can start from scratch -

  • Remove all tables from your DB
  • Ensure you have all your migrations - and they are correct and in order (for foreign keys etc.)
  • Run php artisan migrate

It looks like it is trying to rollback migrations for files that no longer exist. SO its looking for the password rest file but it cant find it so errors out.

Please or to participate in this conversation.