You can run the following command: script/dbconsole And then manually drop the sessions table (drop sessions). Then try full rollbacks and migrations again.
Sent from my iPhone On Jul 30, 2010, at 2:36 AM, Rick R <[email protected]> wrote: > I'm sure this is total newb (since I am pretty newb) but I'm curious what the > issue is here. I attempt to role back all my migrations which I'm doing with > > rake db:migrate VERSION=0 > (in /Users/rick/projects/rails/sillymeters) > == CreateSessions: never migrated, skipping > ================================== > > == CreateUsers: reverting > ==================================================== > -- drop_table(:users) > -> 0.0011s > == CreateUsers: reverted (0.0012s) > =========================================== > > == CreateMeters: reverting > =================================================== > -- drop_table(:meters) > -> 0.0008s > == CreateMeters: reverted (0.0009s) > ========================================== > > etc.. > > Note the first one says "CreateSessions: never migrated, skipping" > > When I then go to run the migrations, most go through fine, but then I get > the following error when it tries to run the CreateSessions migration: > > ~/projects/rails/sillymeters(master) $ rake db:migrate > (in /Users/rick/projects/rails/sillymeters) > == CreateSessions: migrating > ================================================= > -- create_table(:sessions)- > rake aborted! > An error has occurred, this and all later migrations canceled: > > SQLite3::SQLException: table "sessions" already exists: CREATE TABLE > "sessions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "session_id" > varchar(255) NOT NULL, "data" text, "created_at" datetime, "updated_at" > datetime) > > > I'm assuming that each application has its own instance of SQLLite so I'm > curious how this error is occurring or what I need to do to fix it. I 'think' > I might be getting this because it's possible I did at one point have a > similar migration that created the Session table, but then I deleted that > migration and created it as a new one with a new name. The table name was the > same though "sessions" so I don't get what is going on. > > The migration in question looks like: > > class CreateSessions < ActiveRecord::Migration > def self.up > create_table :sessions do |t| > t.string :session_id, :null => false > t.text :data > t.timestamps > end > > add_index :sessions, :session_id > add_index :sessions, :updated_at > end > > def self.down > drop_table :sessions > end > end > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

