2011-02-01 16 views
0

rake db:migrateを使用してアプリケーションとdbで更新しました。しかし、私はエラーが発生しました:DBマイグレーションの問題

Migrating to CreateSavedBoards (20110111184104) 
== CreateSavedBoards: migrating ============================================== 
-- drop_table(:boards) 
    SQL (0.0ms) Mysql::Error: Unknown table 'boards': DROP TABLE `boards` 
rake aborted! 
An error has occurred, all later migrations canceled: 

Mysql::Error: Unknown table 'boards': DROP TABLE `boards` 

(See full trace by running task with --trace) 

マイグレーションファイルがエラーの原因ですか?

class CreateBoardCategoriesSavedboards < ActiveRecord::Migration 
    def self.up 
    create_table :board_categories_boards, :id => false do |t| 
     t.integer :board_category_id 
     t.integer :board_id 
    end 

    add_index :board_categories_boards, [:board_category_id, :board_id], :name => "bcb_board_category_id_board_id" 
    end 

    def self.down 
    drop_table :board_categories_boards 
    end 
end 

これはボードのモデルです。

class Board < ActiveRecord::Base 
    belongs_to :image, :foreign_key => 'image' 
    belongs_to :clip, :foreign_key => 'clip' 
    has_and_belongs_to_many :categories, :class_name => 'BoardCategory', :foreign_key => 'board_id' 
    has_many :comments, :as => :commentable 
    set_table_name "savedboards" 
end 

私はエラーがboards上記の表は、移行ファイル内board_idので、そこにあることを考えるのRailsから来ていることを考えています。

マイグレーションが失敗する可能性があり、何ができるのでしょうか。

答えて

1

マイグレーションの出力にはdrop_table :boardsが表示されていますが、マイグレーションには表示されません。おそらく、それはboardsテーブルを削除しようとするより早い移行ですか?

+0

正確には古い移行ID CreateSavedBoardsのようです – Mike

+0

私はそれを調べます –

関連する問題