Yes, I agree that the second migration seems to be trying to re-create
the schema table.

The database is a legacy SQL Server db with over 100 tables already in
existence.
I've noticed that db/schema.rb contains no information re the table
that was built, hence rake trying to re-create the schema_migrations
table.
The first migration created a searches table:
class CreateSearches < ActiveRecord::Migration
  def self.up
    create_table :searches do |t|
      t.date :start
      t.date :end
      t.integer :team_id
      t.integer :match_id
      t.integer :innings_id
      t.integer :over_id
      t.integer :ball_id
      t.integer :match_session_id
      t.integer :bowler_id
      t.integer :delivery_type_id
      t.integer :extra_type_id
      t.integer :appeal_id
      t.integer :shot_type_id
      t.integer :runs_id
      t.integer :batter_id
      t.integer :umpire_id
      t.integer :validity_id
      t.integer :decison_id
      t.integer :height_id
      t.integer :extra_runs_id
      t.timestamps
    end
  end

  def self.down
    drop_table :searches
  end
end
 and the second migration tried to rename one of the columns:

class RenameTeamId < ActiveRecord::Migration
  def self.up
    rename_column :searches, :team_id, :home_team_id
  end

  def self.down
    rename_column :searches, :home_team_id, :team_id
  end
end

Dropping the whole DB is really not an option.
Martin

On Jan 8, 4:41 pm, "Hassan Schroeder" <hassan.schroe...@gmail.com>
wrote:
> On Thu, Jan 8, 2009 at 8:36 AM, Martin Hawkins <martin.hawk...@gmail.com> 
> wrote:
> > No, I didn't edit an existing migration - I created a new one for the
> > rename.
>
> It sounds like your second migration is trying to create the schema table
> which already exists.
>
> Maybe you could post your migrations, or at least the failing one?
>
> > I understand what you are saying about dropping the table (not the
> > entire db surely :-0).
>
> Yes, the whole DB -- if you're wanting to fix a bad migration and run
> it all from the beginning. That's not a bad thing early in a project.
>
> --
> Hassan Schroeder ------------------------ hassan.schroe...@gmail.com
--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to