Jump to content

The ultimate community for Ruby on Rails developers.


Photo

Issue trying to drop a table / migration in Rails 4


  • Please log in to reply
No replies to this topic

#1 malditojavi

malditojavi

    Passenger

  • Members
  • 1 posts

Posted 19 June 2014 - 06:05 PM

I have tried to implement a gem that uses the same model (comment.rb) as one of the gem I was trying to install before. I have tried rake db:rollback and rake db:rollback VERSION= to come back to the point where I'm supposed not to have any migrations or any tables named 'comment', but sqlite3 keeps telling me that there is a table with that name and it can not move forward.

rake db:migrate:status

Status Migration ID Migration Name
--------------------------------------------------
up 20140616150625 Devise create users
up
20140616151746 Create hacks
up
20140616155718 Acts as taggable on migration.acts as taggable on engine
up
20140616155719 Add missing unique indices.acts as taggable on engine
up
20140616155720 Add taggings counter cache to tags.acts as taggable on engine
up
20140617185601 Add picture to hacks
up
20140617190705 Add attachment image to hacks
up
20140617194434 Add name to users
up
20140617194509 Create identities
up
20140618125514 Add confirmable to devise
up
20140619150148 Create comments
up
20140619162204 The comments change user.the comments engine
down
20140619162205 The comments create comments.the comments engine
down
20140619162206 The comments change commentable.the comments engine
down
20140619163035 Drop comments
 
And the issue - I'm not sure if this called rack trace? rake aborted! StandardError: An error has occurred, this and all later migrations canceled:
 
SQLite3::SQLException: table "comments" already exists: CREATE TABLE "comments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "holder_id" integer, "commentable_id" integer, "commentable_type" varchar(255), "commentable_url" varchar(255), "commentable_title" varchar(255), "commentable_state" varchar(255), "anchor" varchar(255), "title" varchar(255), "contacts" varchar(255), "raw_content" text, "content" text, "view_token" varchar(255), "state" varchar(255) DEFAULT 'draft', "ip" varchar(255) DEFAULT 'undefined', "referer" varchar(255) DEFAULT 'undefined', "user_agent" varchar(255) DEFAULT 'undefined', "tolerance_time" integer, "spam" boolean DEFAULT 'f', "parent_id" integer, "lft" integer, "rgt" integer, "depth" integer DEFAULT 0, "created_at" datetime, "updated_at" datetime) /Users/javier/.rvm/gems/ruby-2.1.2/gems/sqlite3-1.3.9/lib/sqlite3/database.rb:91:in `initialize'
 

I have tried to drop the same table by accessing sqlite3, but I'm not able to access the tables. Any advice?

 

 






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users