Error after add index to email (Rails tutorial chap 6)


Hi! I got some errors after add index to email of users table. Can any one help me solve this?
Here is the picture.


As it says run bin/rails db:migrate RAILS_ENV=test in the terminal.

The migration was only ran against the dev database and not the test one so you need to run the migration against the test db too.


It still has errror!!!


After I drop all the database, destroy all migration files and build it again, It works fine.
I think the reason would be caused by the duplication in the database (I’m guessing that!!!)