I made a mistake in my migration file and I deleted and then tried running the migration again and now I'm getting an activerecord::pendingmigrationerror when I load localhost:3000 but when I try to run rails:db migrate
again its keeps canceling with this message:
Jerrys-MacBook-Air:nameofapp jerryhoglen$ rails db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate == 20161227120926 AddAdminFlagToUsers: migrating ============================== -- add_column(:users, :admin, :boolean, {:default=>false, :null=>false}) rails aborted! StandardError: An error has occurred, this and all later migrations canceled: SQLite3::SQLException: duplicate column name: admin: ALTER TABLE "users" ADD "admin" boolean DEFAULT 'f' NOT NULL"
Cant figure it out! please help
You can run
rake db:drop
thenrake db:create && rake db:migrate
to set up a new local database or insert the value20161227120926
into theschema_migrations
table.