rake db:rollback of a recent migration hangs - ruby-on-rails-3

I have a rails app that I wrote originally in rail 3, and upgraded to rails 3.1.10 about a month ago. I just created a habtm association between stories and tags, along with the related db migrations.
class Story < ActiveRecord::Base
belongs_to :user
has_and_belongs_to_many :tags, :uniq => true
end
class Tag < ActiveRecord::Base
has_and_belongs_to_many :stories, :uniq => true
end
class CreateTags < ActiveRecord::Migration
def change
create_table :tags do |t|
t.string :name
t.timestamps
end
end
end
class CreateStoriesTags < ActiveRecord::Migration
def change
create_table :stories_tags, :id => false do |t|
t.references :story, :tag
end
add_index :stories_tags, [:story_id, :tag_id]
end
end
And finally, here is the relevant schema.db:
create_table "stories", :force => true do |t|
t.string "title"
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "stories", ["user_id"], :name => "index_stories_on_user_id"
create_table "stories_tags", :id => false, :force => true do |t|
t.integer "story_id"
t.integer "tag_id"
end
add_index "stories_tags", ["story_id", "tag_id"], :name => "index_stories_tags_on_story_id_and_tag_id"
create_table "tags", :force => true do |t|
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
end
I migrated the DB and then played around with the associations in the console. Now I want to rollback the migration so to add some additional columns to the tags table. (I know that I could simply create a new migration, but I would still want to understand why I'm facing this problem.) Now, when I insert rake db:rollback into the console here is the initial output:
[nw0.0.1master (development)]$ rake db:rollback
== CreateStoriesTags: reverting ==============================================
-- drop_table(:stories_tags)
So far so good, but then the rake task just hangs . . . for hours. If I ctrl-c out of it here is the output to the console:
^Crake aborted!
An error has occurred, this and all later migrations canceled:
Interrupt: : ROLLBACK
/.rvm/gems/ruby-1.9.2-p290#rails3firstgemset/gems/activerecord-3.1.10/lib/active_record/connection_adapters/postgresql_adapter.rb:605:in `async_exec'
/.rvm/gems/ruby-1.9.2-p290#rails3firstgemset/gems/activerecord-3.1.10/lib/active_record/connection_adapters/postgresql_adapter.rb:605:in `block in execute'
/.rvm/gems/ruby-1.9.2-p290#rails3firstgemset/gems/activerecord-3.1.10/lib/active_record/connection_adapters/abstract_adapter.rb:245:in `block in log'
/.rvm/gems/ruby-1.9.2-p290#rails3firstgemset/gems/activesupport-3.1.10/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/.rvm/gems/ruby-1.9.2-p290#rails3firstgemset/gems/activerecord-3.1.10/lib/active_record/connection_adapters/abstract_adapter.rb:240:in `log'
/.rvm/gems/ruby-1.9.2-p290#rails3firstgemset/gems/activerecord-3.1.10/lib/active_record/connection_adapters/postgresql_adapter.rb:604:in `execute'
/.rvm/gems/ruby-1.9.2-p290#rails3firstgemset/gems/activerecord-3.1.10/lib/active_record/connection_adapters/postgresql_adapter.rb:664:in `rollback_db_transaction'
/.rvm/gems/ruby-1.9.2-p290#rails3firstgemset/gems/activerecord-3.1.10/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `rescue in transaction'
/.rvm/gems/ruby-1.9.2-p290#rails3firstgemset/gems/activerecord-3.1.10/lib/active_record/connection_adapters/abstract/database_statements.rb:182:in `transaction'
/.rvm/gems/ruby-1.9.2-p290#rails3firstgemset/gems/activerecord-3.1.10/lib/active_record/transactions.rb:208:in `transaction'
/.rvm/gems/ruby-1.9.2-p290#rails3firstgemset/gems/activerecord-3.1.10/lib/active_record/migration.rb:742:in `ddl_transaction'
/.rvm/gems/ruby-1.9.2-p290#rails3firstgemset/gems/activerecord-3.1.10/lib/active_record/migration.rb:686:in `block in migrate'
/.rvm/gems/ruby-1.9.2-p290#rails3firstgemset/gems/activerecord-3.1.10/lib/active_record/migration.rb:671:in `each'
/.rvm/gems/ruby-1.9.2-p290#rails3firstgemset/gems/activerecord-3.1.10/lib/active_record/migration.rb:671:in `migrate'
/.rvm/gems/ruby-1.9.2-p290#rails3firstgemset/gems/activerecord-3.1.10/lib/active_record/migration.rb:553:in `down'
/.rvm/gems/ruby-1.9.2-p290#rails3firstgemset/gems/activerecord-3.1.10/lib/active_record/migration.rb:627:in `move'
/.rvm/gems/ruby-1.9.2-p290#rails3firstgemset/gems/activerecord-3.1.10/lib/active_record/migration.rb:541:in `rollback'
/.rvm/gems/ruby-1.9.2-p290#rails3firstgemset/gems/activerecord-3.1.10/lib/active_record/railties/databases.rake:232:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:rollback
(See full trace by running task with --trace)
Couple of things to note, as this app started out w/ rails 3.0, all early migrations use the older Class.up Class.down methods to define the migrations. Also, when I first expirienced the hanging I switched the CreateStoriesTags migration to use up and down instance methods, but everything still hung.
UPDATE AND THE ANSWER
I noticed that the PGAdmin3 Workbench was also hanging. So, I restarted the Mac and now the rollbacks are working just find.

Turned out to be a problem with my db server. A simple restart fixed the problem

Related

Database associations causing issues in db migration with postgres

I've been making a basic schema for a rails app but when I try to migrate it using rails db:migrate, it gives me some weird association errors that I'm not sure what's causing.
== 20211001092658 CreateDevelopers: migrating =================================
-- create_table(:developers)
-> 0.0076s
== 20211001092658 CreateDevelopers: migrated (0.0077s) ========================
== 20211001093122 CreateMessages: migrating ===================================
-- create_table(:messages)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::UndefinedTable: ERROR: relation "teams" does not exist
/home/nero/Projects/SMS-Rails/db/migrate/20211001093122_create_messages.rb:3:in `change'
Caused by:
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "teams" does not exist
/home/nero/Projects/SMS-Rails/db/migrate/20211001093122_create_messages.rb:3:in `change'
Caused by:
PG::UndefinedTable: ERROR: relation "teams" does not exist
/home/nero/Projects/SMS-Rails/db/migrate/20211001093122_create_messages.rb:3:in `change'
Tasks: TOP => db:migrate
I've been having a few issues setting up Postgres on my machine but I figured most of it would be solved after I created the role, password and database.
Migration files:
#developers
class CreateDevelopers < ActiveRecord::Migration[6.1]
def change
create_table :developers do |t|
t.string :full_name
t.string :email
t.string :mobile
t.timestamps
end
end
end
#teams
class CreateTeams < ActiveRecord::Migration[6.1]
def change
create_table :teams do |t|
t.string :name
t.string :dept_name
t.string :dev_ids, array: true, default: []
t.timestamps
end
end
end
#messages
class CreateMessages < ActiveRecord::Migration[6.1]
def change
create_table :messages do |t|
t.references :team, null: false, foreign_key: true
t.string :title
t.text :content
t.timestamps
end
end
end

Adding attribute to already existing model

I am trying to add user:references onto my already existing model. This is what I originally wrote:
rails g model Post title:string description:text
I do this to add the user:references by running rails generate migration add_user_to_posts user:references, I am receiving this error upon running rake db:migrate:
-- create_table(:users)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: table "users" already exists
I am reading the error and I understand I already have a User model, however, I want to add this attribute to the Post model, not the User model.
Db file:
Posts:
class CreatePosts < ActiveRecord::Migration[5.0]
def change
create_table :posts do |t|
t.string :title
t.text :description
t.timestamps
end
end
end
Trying to add the user to posts:
class AddUserToPosts < ActiveRecord::Migration[5.0]
def change
add_reference :posts, :user, foreign_key: true
end
end
Users:
class CreateUsers < ActiveRecord::Migration[5.0]
def change
create_table :users do |t|
t.string :name
t.string :uid
t.string :avatar_url
t.timestamps
end
add_index :users, :uid
end
end
However, rake db:migrate gives me the error above.

SQLException on db:test:load with Rails

I've been working on a small but somewhat complex Rails application with multiple has_and_belongs_to_many relationships. It's open source, and the code is here. Everything was working fine, but recently I added a new HABTM relationship migration, and an rspec test started to fail. Rake:db:migrate was working (and the issue was working locally), just not in testing. Upon running db:test:load --trace , I get the following error:
:fermi og$ rake db:test:load --trace /Users/og/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/yaml.rb:56:in
<top (required)>': It seems your ruby installation is missing psych
(for YAML output). To eliminate this warning, please install libyaml
and reinstall your ruby.
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:test:purge
** Execute db:test:load
** Invoke db:test:load_schema (first_time)
** Invoke db:test:purge
** Execute db:test:load_schema
** Invoke db:schema:load (first_time)
** Invoke environment
** Invoke db:load_config
** Execute db:schema:load rake aborted! SQLite3::SQLException: object name reserved for internal use: sqlite_sp_functions: CREATE TABLE
"sqlite_sp_functions" ("name" text, "text" text)
/Users/og/.rvm/gems/ruby-1.9.3-head/gems/sqlite3-1.3.7/lib/sqlite3/database.rb:91:in
initialize'
/Users/og/.rvm/gems/ruby-1.9.3-head/gems/sqlite3-1.3.7/lib/sqlite3/database.rb:91:in
new'
/Users/og/.rvm/gems/ruby-1.9.3-head/gems/sqlite3-1.3.7/lib/sqlite3/database.rb:91:in
prepare'
/Users/og/.rvm/gems/ruby-1.9.3-head/gems/sqlite3-1.3.7/lib/sqlite3/database.rb:134:in
execute'
/Users/og/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.9/lib/active_record/connection_adapters/sqlite_adapter.rb:278:in
block in execute'
/Users/og/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract_adapter.rb:280:in block in log'
/Users/og/.rvm/gems/ruby-1.9.3-head/gems/activesupport-3.2.9/lib/active_support/notifications/instrumenter.rb:20:in
instrument'
/Users/og/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract_adapter.rb:275:in log'
/Users/og/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.9/lib/active_record/connection_adapters/sqlite_adapter.rb:278:in
execute'
/Users/og/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/schema_statements.rb:170:in
create_table'
/Users/og/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.9/lib/active_record/migration.rb:466:inblock in method_missing'
/Users/og/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.9/lib/active_record/migration.rb:438:in block in say_with_time'
/Users/og/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/benchmark.rb:280:in
measure'
/Users/og/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.9/lib/active_record/migration.rb:438:in say_with_time'
/Users/og/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.9/lib/active_record/migration.rb:458:inmethod_missing' /Users/og/Documents/websites/fermi/db/schema.rb:49:in
block in <top (required)>'
/Users/og/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.9/lib/active_record/schema.rb:50:in
instance_eval'
/Users/og/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.9/lib/active_record/schema.rb:50:in
define' /Users/og/Documents/websites/fermi/db/schema.rb:14:in'
/Users/og/.rvm/gems/ruby-1.9.3-head/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:245:in
load'
/Users/og/.rvm/gems/ruby-1.9.3-head/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:245:in
block in load'
/Users/og/.rvm/gems/ruby-1.9.3-head/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:236:in
load_dependency'
/Users/og/.rvm/gems/ruby-1.9.3-head/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:245:in
load'
/Users/og/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.9/lib/active_record/railties/databases.rake:388:in
block (3 levels) in <top (required)>'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/task.rb:246:in
call'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/task.rb:246:in
block in execute'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/task.rb:241:in
each'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/task.rb:241:in
execute'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/task.rb:184:in
block in invoke_with_call_chain'
/Users/og/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/monitor.rb:211:in
mon_synchronize'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/task.rb:177:in
invoke_with_call_chain'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/task.rb:170:in
invoke'
/Users/og/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.9/lib/active_record/railties/databases.rake:499:in
block (3 levels) in '
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/task.rb:246:in
call'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/task.rb:246:in
block in execute'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/task.rb:241:in
each'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/task.rb:241:in
execute'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/task.rb:184:in
block in invoke_with_call_chain'
/Users/og/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/monitor.rb:211:in
mon_synchronize'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/task.rb:177:in
invoke_with_call_chain'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/task.rb:170:in
invoke'
/Users/og/.rvm/gems/ruby-1.9.3-head/gems/activerecord-3.2.9/lib/active_record/railties/databases.rake:479:in
block (3 levels) in <top (required)>'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/task.rb:246:in
call'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/task.rb:246:in
block in execute'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/task.rb:241:in
each'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/task.rb:241:in
execute'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/task.rb:184:in
block in invoke_with_call_chain'
/Users/og/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/monitor.rb:211:in
mon_synchronize'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/task.rb:177:in
invoke_with_call_chain'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/task.rb:170:in
invoke'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/application.rb:143:in
invoke_task'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/application.rb:101:in
block (2 levels) in top_level'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/application.rb:101:in
each'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/application.rb:101:in
block in top_level'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/application.rb:110:in
run_with_threads'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/application.rb:95:in
top_level'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/application.rb:73:in
block in run'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/application.rb:160:in
standard_exception_handling'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/lib/rake/application.rb:70:in
run'
/Users/og/.rvm/gems/ruby-1.9.3-head#global/gems/rake-10.0.4/bin/rake:33:in
<top (required)>' /Users/og/.rvm/gems/ruby-1.9.3-head/bin/rake:23:in
load' /Users/og/.rvm/gems/ruby-1.9.3-head/bin/rake:23:in `'
Tasks: TOP => db:schema:load
My schema.rb file is the following:
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20130519192155) do
create_table "distributions", :force => true do |t|
t.float "mean"
t.float "spread"
t.float "wideness"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "operation_id"
t.string "type"
t.string "name"
end
create_table "distributions_models", :id => false, :force => true do |t|
t.integer "distribution_id"
t.integer "model_id"
end
create_table "distributions_operations", :id => false, :force => true do |t|
t.integer "distribution_id"
t.integer "operation_id"
end
create_table "models", :force => true do |t|
t.string "name"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "operations", :force => true do |t|
t.string "operator"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "sqlite_sp_functions", :id => false, :force => true do |t|
t.text "name"
t.text "text"
end
# Could not dump table "sqlite_stat1" because of following StandardError
# Unknown type '' for column 'tbl'
# Could not dump table "sqlite_stat3" because of following StandardError
# Unknown type '' for column 'tbl'
create_table "sqlite_vs_links_names", :id => false, :force => true do |t|
t.text "name"
t.text "alias"
end
create_table "sqlite_vs_properties", :id => false, :force => true do |t|
t.text "parentType"
t.text "parentName"
t.text "propertyName"
t.text "propertyValue"
end
create_table "sqlite_vsp_diagrams", :id => false, :force => true do |t|
t.text "name"
t.text "diadata"
t.text "comment"
t.text "preview"
end
end
Any help or information would be much appreciated. I've search these errors online for quite a while, but have found very little online.
What worked for me was to delete schema.rb, which is the schema definition file.
(The first paragraph of comments within this file recommends deleting it and generating a new one, rather than editing it.)
Then just run rake db:migrate, which performs all the migrations and re-creates the schema.rb file.
I got the similar error either and I have no idea. But when I delete those code, in this case,
try delete these line:
create_table "sqlite_sp_functions", :id => false, :force => true do |t|
t.text "name"
t.text "text"
end
# Could not dump table "sqlite_stat1" because of following StandardError
# Unknown type '' for column 'tbl'
# Could not dump table "sqlite_stat3" because of following StandardError
# Unknown type '' for column 'tbl'
create_table "sqlite_vs_links_names", :id => false, :force => true do |t|
t.text "name"
t.text "alias"
end
create_table "sqlite_vs_properties", :id => false, :force => true do |t|
t.text "parentType"
t.text "parentName"
t.text "propertyName"
t.text "propertyValue"
end
create_table "sqlite_vsp_diagrams", :id => false, :force => true do |t|
t.text "name"
t.text "diadata"
t.text "comment"
t.text "preview"
end
then rake test:prepare might work.
Add the following config line to config/application.rb or in config/environments/development.rb:
ActiveRecord::SchemaDumper.ignore_tables = /^sqlite_*/
This will ignore all tables starting with "sqlite_" in your database during the schema dump.

rake migrate aborted for undefined local variable or method

Got a issue when i run rake db:migrate. The mistake message is like
-- create_table(:addresses)
-> 0.1792s
-- contact_id()
rake aborted!
An error has occurred, this and all later migrations canceled:
undefined local variable or method `contact_id' for #<CreateAddresses:0x00000001724718>/var/lib/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/migration.rb:465:in `block in method_missing'
And i used command before migrate
rails g model address street:string city:string region:string postalcode:string country:string contact_id:integer
And my migration file :
class CreateAddresses < ActiveRecord::Migration
def change
create_table :addresses do |t|
t.string :street
t.string :city
t.string :region
t.string :postalcode
t.string :country
t.integer :contact_id
t.timestamps
end
add_index :addresses, [contact_id, :create_at]
end
end
Could anybody tell where i made mistake please? Thank you a lot.
you are missing : before contact_id:
add_index :addresses, [:contact_id, :create_at]

How do I add columns to devise after the initial create_table rake?

I installed Devise, raked, and then realized afterwards, that I want to add :confirmable.
Can I go back to the same initial migration and just uncomment out the helper that I want and then rake db:migrate again?
I tried it and it didn't seem to work. But I haven't seen an example of how to create a follow-on migration.
Thanks!
This is what I tried:
1 class AddConfirmableToUsers < ActiveRecord::Migration
2 def self.up
3 change_table :users do |t|
4 t.confirmable
5 end
6 add_index :users, :confirmation_token, :unique => true
7 end
8
9 def self.down
10 remove_column :users, :confirmation_token
11 end
12
13 end
You can add the proper columns yourself like so:
class AddConfirmableToUsers < ActiveRecord::Migration
def self.up
change_table :users do |t|
t.string :confirmation_token
t.datetime :confirmed_at
t.datetime :confirmation_sent_at
end
add_index :users, :confirmation_token, :unique => true
end
def self.down
change_table :users do |t|
t.remove :confirmation_token, :confirmed_at, :confirmation_sent_at
end
remove_index :users, :confirmation_token
end
end
Your migration should work. Did you check your User model to make sure :confirmable is enabled? It's commented out by default.
If you don't mind losing your data you can just do
> rake db:drop
Otherwise you can just edit the initial migration and do a rollback.
# get the current migration version
> rake db:version
> Current version: ****************41
> rake db:rollback ****************40
Make your changes
> rake db:migrate