我正在尝试将列添加到我的SQLITE3数据库并遇到一些问题。 当我在终端中运行rake db:migrate时,我得到:
SQLite3 :: CorruptException:数据库 磁盘映像格式错误:INSERT INTO “schema_migrations”(“版本”)VALUES ( '20110425202452')
以下是添加列的代码:
class AddPhotoToItem < ActiveRecord::Migration
def self.up
add_column :items, :preview_photo_file_name, :string
add_column :items, :preview_photo_content_type, :string
add_column :items, :preview_photo_file_size, :integer
add_column :items, :thumbnail_photo_file_name, :string
add_column :items, :thumbnail_photo_content_type, :string
add_column :items, :thumbnail_photo_file_size, :integer
end
def self.down
remove_column :items, :preview_photo_file_name, :string
remove_column :items, :preview_photo_content_type, :string
remove_column :items, :preview_photo_file_size, :integer
remove_column :items, :thumbnail_photo_file_name, :string
remove_column :items, :thumbnail_photo_content_type, :string
remove_column :items, :thumbnail_photo_file_size, :integer
end
end
有什么问题?提前谢谢!
答案 0 :(得分:1)